1873 lines
92 KiB
PHP
1873 lines
92 KiB
PHP
|
|
<?php include('techsyn_header.php'); ?>
|
|||
|
|
<!-- Main Content Container for side bar and body-->
|
|||
|
|
<div class="main-container ace-save-state" id="main-container">
|
|||
|
|
<script type="text/javascript">
|
|||
|
|
try {
|
|||
|
|
ace.settings.loadState('main-container')
|
|||
|
|
} catch (e) {}
|
|||
|
|
</script>
|
|||
|
|
<?php include('techsyn_sidebar.php'); ?>
|
|||
|
|
|
|||
|
|
<!--breadcrumb-->
|
|||
|
|
<div class="main-content">
|
|||
|
|
<div class="main-content-inner">
|
|||
|
|
<div class="breadcrumbs ace-save-state" id="breadcrumbs">
|
|||
|
|
<ul class="breadcrumb">
|
|||
|
|
<li class="#"><a href='item_issue_list.php'>Item Issue</a></li>
|
|||
|
|
<li class="active"><a href='item_issue_list.php'>Veterinary Treatment</a></li>
|
|||
|
|
</ul>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<!-- Modal Structure -->
|
|||
|
|
<div class="modal fade" id="groupItemsModal" tabindex="-1" role="dialog" aria-labelledby="groupItemsModalLabel" aria-hidden="true">
|
|||
|
|
<div class="modal-dialog" role="document">
|
|||
|
|
<div class="modal-content">
|
|||
|
|
<div class="modal-header">
|
|||
|
|
<h5 class="modal-title" id="groupItemsModalLabel">Group Items</h5>
|
|||
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|||
|
|
|
|||
|
|
<span aria-hidden="true">×</span>
|
|||
|
|
</button>
|
|||
|
|
</div>
|
|||
|
|
<div class="modal-body">
|
|||
|
|
<table class="table" id="itemsTable">
|
|||
|
|
<thead>
|
|||
|
|
<tr>
|
|||
|
|
<th>Item Name</th>
|
|||
|
|
<th>Issue Qty</th>
|
|||
|
|
</tr>
|
|||
|
|
</thead>
|
|||
|
|
<tbody>
|
|||
|
|
<!-- Rows will be inserted here dynamically -->
|
|||
|
|
</tbody>
|
|||
|
|
</table>
|
|||
|
|
</div>
|
|||
|
|
<div class="modal-footer">
|
|||
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<script>
|
|||
|
|
function getActivities(programId) {
|
|||
|
|
// alert('hello');
|
|||
|
|
if (programId) {
|
|||
|
|
$.ajax({
|
|||
|
|
type: "POST",
|
|||
|
|
url: "get_activities.php", // Path to your PHP file
|
|||
|
|
data: {
|
|||
|
|
program_id: programId
|
|||
|
|
},
|
|||
|
|
success: function(response) {
|
|||
|
|
$('#activity_name').html(response); // Populate the activity dropdown
|
|||
|
|
},
|
|||
|
|
error: function() {
|
|||
|
|
alert('Error fetching activities');
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
} else {
|
|||
|
|
$('#activity_name').html('<option value="">Select a Program First</option>');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
</script>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
<!-- End of breadcrumb -->
|
|||
|
|
<div class="page-content">
|
|||
|
|
<div class="box box-primary" style="padding: 10px; margin: 2px 0px 50px 5px; width: 99.5%; ">
|
|||
|
|
<div class="box-header with-border" style="text-align:center">
|
|||
|
|
<h3 class="box-title">Veterinary Treatment</h3>
|
|||
|
|
</div>
|
|||
|
|
<form role="form" id="direct_item_issue" name="direct_item_issue" method="post">
|
|||
|
|
<!-- box-body-->
|
|||
|
|
<input type="hidden" name="stock_issue_id" id="stock_issue_id"
|
|||
|
|
value="<?php echo $_REQUEST['stock_issue_id'] ?>">
|
|||
|
|
<?php
|
|||
|
|
$i = 0;
|
|||
|
|
if (isset($_REQUEST['stock_issue_id'])) {
|
|||
|
|
$sql = "SELECT * FROM stock_issue where stock_issue_id='" . $_REQUEST['stock_issue_id'] . "' ";
|
|||
|
|
// echo "query:".$sql;
|
|||
|
|
$result = mysqli_query($conn, $sql);
|
|||
|
|
$num_rows = @mysqli_num_rows($result);
|
|||
|
|
$row = null;
|
|||
|
|
if ($num_rows > 0) {
|
|||
|
|
$row = @mysqli_fetch_array($result);
|
|||
|
|
}
|
|||
|
|
@extract($row);
|
|||
|
|
}
|
|||
|
|
?>
|
|||
|
|
<div class="box-body">
|
|||
|
|
<div class="row">
|
|||
|
|
<div class="col-sm-2">
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label>Issue Date</label>
|
|||
|
|
<div class="input-group date">
|
|||
|
|
<div class="input-group-addon">
|
|||
|
|
<i class="fa fa-calendar"></i>
|
|||
|
|
</div>
|
|||
|
|
<input type="text" name="issue_date" id="issue_date" class="form-control pull-right">
|
|||
|
|
</div>
|
|||
|
|
<!-- /.input group -->
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<?php
|
|||
|
|
if ($_SESSION['RoleCode'] == 'VTIA' || $_SESSION['RoleCode'] == 'VTIC' || $_SESSION['RoleCode'] == 'TP12') {
|
|||
|
|
$beneficiary_type = 'VTI';
|
|||
|
|
} else {
|
|||
|
|
$beneficiary_type = 'CSR';
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ($beneficiary) {
|
|||
|
|
} else {
|
|||
|
|
|
|||
|
|
$beneficiary = $_REQUEST['pa_id'];
|
|||
|
|
// $benefit_program_eligibility = getFieldFromTable('benefit_program_eligibility','patient_master','id',$beneficiary);
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
?>
|
|||
|
|
<script></script>
|
|||
|
|
<?php
|
|||
|
|
if ($benefit_program_eligibility) {
|
|||
|
|
?><script>
|
|||
|
|
getActivities(<?php echo $benefit_program_eligibility ?>);
|
|||
|
|
</script>
|
|||
|
|
<?php
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ($program_name != '' && $program_name != null) {
|
|||
|
|
$benefit_program_eligibility = $program_name;
|
|||
|
|
} else {
|
|||
|
|
$benefit_program_eligibility = getFieldFromTable('benefit_program_eligibility', 'patient_master', 'id', $beneficiary);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
?>
|
|||
|
|
|
|||
|
|
|
|||
|
|
<div class="col-sm-3">
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label>Beneficiary<span style="color: red;"> *</span> </label>
|
|||
|
|
<select class="form-control select2" id="beneficiary" onchange="getParamters()" name="beneficiary" data-placeholder="Choose a Beneficiary..." style="width: 290px;">
|
|||
|
|
<option value=""></option>
|
|||
|
|
<?php
|
|||
|
|
$ohc_type_id = $_SESSION['current_ohcttype'];
|
|||
|
|
|
|||
|
|
echo generate_options("SELECT id, CONCAT(patient_name, ' (', aadhar_phone, ')') AS patient_name FROM patient_master where FIND_IN_SET($ohc_type_id, ohc_type_id) and beneficiary_type = '$beneficiary_type' order by id desc", $beneficiary, 'id', 'patient_name', '', '');
|
|||
|
|
|
|||
|
|
|
|||
|
|
// echo generateOption('patient_master', 'patient_name', 'id', $beneficiary, '')
|
|||
|
|
?>
|
|||
|
|
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="col-sm-2">
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label>Program</label>
|
|||
|
|
<select class="form-control select2" id="program_name" name="program_name" onchange="getActivities(this.value)" data-placeholder="Choose a item..." style="width: 290px;">
|
|||
|
|
<option value=""></option>
|
|||
|
|
<?php if($benefit_program_eligibility){
|
|||
|
|
$benefit_program_eligibility= $benefit_program_eligibility;
|
|||
|
|
}else{
|
|||
|
|
$benefit_program_eligibility = '1';
|
|||
|
|
} ?>
|
|||
|
|
<?php echo generateOption('csr_program', 'program_name', 'csr_id', $benefit_program_eligibility, '') ?>
|
|||
|
|
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="col-sm-3">
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label>Activity <span style="color: red;"> *</span></label>
|
|||
|
|
<select class="form-control select2" id="activity_name" name="activity_name" onchange="setAgency();removeOldData();filterItems();getParamters()" data-placeholder="Choose a item..." style="width: 290px;">
|
|||
|
|
<option value=""></option>
|
|||
|
|
<!-- <?php echo generateOptionWithWhereClause('program_master', 'program_name', 'program_id', $activity_name, '', 'program_status', '"Active"') ?> -->
|
|||
|
|
|
|||
|
|
<?php
|
|||
|
|
if($activity_name){
|
|||
|
|
$activity_name = $activity_name;
|
|||
|
|
}else{
|
|||
|
|
$activity_name = '9';
|
|||
|
|
}
|
|||
|
|
echo generateOptionWithTwoWhereClauseWithFindSet(
|
|||
|
|
'program_master',
|
|||
|
|
'program_name',
|
|||
|
|
'program_id',
|
|||
|
|
$activity_name,
|
|||
|
|
'',
|
|||
|
|
'program_status',
|
|||
|
|
'Active',
|
|||
|
|
'involved_process',
|
|||
|
|
2
|
|||
|
|
);
|
|||
|
|
?>
|
|||
|
|
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
|
|||
|
|
<input type="hidden" name="check_item" id="check_item"
|
|||
|
|
value="">
|
|||
|
|
<input type="hidden" name="check_qty" id="check_qty"
|
|||
|
|
value="">
|
|||
|
|
|
|||
|
|
|
|||
|
|
<div class="col-sm-2">
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label>Agency <span style="color: red;"> *</span></label>
|
|||
|
|
<select class="form-control select2" id="distribution_vendor" name="distribution_vendor" data-placeholder="Choose a item..." style="width: 290px;" onchange="removeOldData();filterItems()">
|
|||
|
|
<option value=""></option>
|
|||
|
|
<?php
|
|||
|
|
if($distribution_vendor){
|
|||
|
|
$distribution_vendor = $distribution_vendor;
|
|||
|
|
}else{
|
|||
|
|
$distribution_vendor = '52';
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
echo generateOptionWithWhereClause('agency', 'agency_name', 'id', $distribution_vendor, '', 'ohc_type_id', $_SESSION['current_ohcttype']) ?>
|
|||
|
|
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
<div class="row">
|
|||
|
|
|
|||
|
|
<div class="col-sm-2">
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label>Animal <span style="color: red;"> *</span></label>
|
|||
|
|
<select class="form-control select2" id="animal" name="animal" data-placeholder="Choose a animal..." style="width: 290px;" >
|
|||
|
|
<option value=""></option>
|
|||
|
|
<?php echo generateOption('animal_type', 'animal_type_name', 'id', $animal, '', '', '') ?>
|
|||
|
|
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="col-sm-2">
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label>Animal Type<span style="color: red;"> *</span></label>
|
|||
|
|
<select class="form-control select2" id="animal_type" name="animal_type" data-placeholder="Choose a animal..." style="width: 290px;" >
|
|||
|
|
<option <?php if ($animal_type == 'personal') echo 'selected'; ?> value="personal">Personal Animal</option>
|
|||
|
|
<option <?php if ($animal_type == 'street') echo 'selected'; ?> value="street">Street Animal</option>
|
|||
|
|
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="col-sm-2">
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label>Animal Tag</label>
|
|||
|
|
<input type="text" value="<?= $animal_tag ?>" name="animal_tag" class="form-control" id="animal_tag" placeholder="Enter Animal Tag">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="col-sm-2">
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label>Diagnosis <span style="color: red;"> *</span></label>
|
|||
|
|
<select class="form-control select2" id="diagnosis" name="diagnosis" data-placeholder="Choose a diagnosis..." style="width: 290px;" >
|
|||
|
|
<option value=""></option>
|
|||
|
|
<?php echo generateOption('ailment', 'ailment_name', 'ailment_id', $diagnosis, '', '', '') ?>
|
|||
|
|
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label>Remarks</label>
|
|||
|
|
<textarea id="remarks" name="remarks" class="form-control" rows="2" placeholder="Enter ..."><?= $remarks ?></textarea>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
|
|||
|
|
<div id="dynamic_form_content" class="row">
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
<br>
|
|||
|
|
|
|||
|
|
<?php
|
|||
|
|
$approval_status = "N";
|
|||
|
|
$isAutoApprove = getConfigKey("AUTO_APPROVE_STORE_DIRECT_ISSUE");
|
|||
|
|
if ($isAutoApprove == "TRUE") {
|
|||
|
|
$approval_status = "Y";
|
|||
|
|
} ?>
|
|||
|
|
<input type="hidden" name="approval_status" value="<?= $approval_status ?>">
|
|||
|
|
<!-- <div class="row" style="margin-left: 200px; margin-right: 200px">
|
|||
|
|
<div class="col-sm-6">
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label>OHC Location</label>
|
|||
|
|
<?php
|
|||
|
|
// $query="select * from tbl_categories";
|
|||
|
|
$k = 0;
|
|||
|
|
$ohc_location = "select ohc_type_name,ohc_type_id from ohc_type WHERE `ohc_category`!='INVENTORY' ";
|
|||
|
|
$result_ohc_location = @mysqli_query($conn, $ohc_location);
|
|||
|
|
while ($row_ohc_loaction = mysqli_fetch_assoc($result_ohc_location)) {
|
|||
|
|
if ($k == 0) { ?>
|
|||
|
|
<div class="radio">
|
|||
|
|
<label>
|
|||
|
|
<input type="radio" name="ohc_loc" id="ohc_loc"
|
|||
|
|
onchange="showOrHideForDiv(this.value)" checked
|
|||
|
|
value="<?php echo $row_ohc_loaction['ohc_type_id']; ?>" class="ace">
|
|||
|
|
<span
|
|||
|
|
class="lbl"><?php echo $row_ohc_loaction['ohc_type_name']; ?></span>
|
|||
|
|
</label>
|
|||
|
|
</div>
|
|||
|
|
<?php } else { ?>
|
|||
|
|
<div class="radio">
|
|||
|
|
<label>
|
|||
|
|
<input type="radio" name="ohc_loc" id="ohc_loc"
|
|||
|
|
onchange="showOrHideForDiv(this.value)"
|
|||
|
|
value="<?php echo $row_ohc_loaction['ohc_type_id']; ?>" class="ace">
|
|||
|
|
<span
|
|||
|
|
class="lbl"><?php echo $row_ohc_loaction['ohc_type_name']; ?></span>
|
|||
|
|
</label>
|
|||
|
|
</div>
|
|||
|
|
<?php }
|
|||
|
|
?>
|
|||
|
|
<?php $k++;
|
|||
|
|
}
|
|||
|
|
?>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="ambulance" style="text-align: center">
|
|||
|
|
<div class="col-sm-6">
|
|||
|
|
<div class="form-group" id=ambulance_div>
|
|||
|
|
<label>Ambulance Number<span style="color: red">*</span></label>
|
|||
|
|
<select class="form-control select2" id="ambulance_number"
|
|||
|
|
name="ambulance_number">
|
|||
|
|
<option disabled selected>Please select option</option>
|
|||
|
|
<?php echo generateOption('ambulance_details_new', 'ambulance_number', 'id', '', ''); ?>
|
|||
|
|
</select>
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group" id=box_div1>
|
|||
|
|
<div class=col-sm-12>
|
|||
|
|
<label>First-Aid Box Number<span style="color: red">*</span></label>
|
|||
|
|
<select class="form-control select2" id="box_number" name="box_number">
|
|||
|
|
<option disabled selected>Please select option</option>
|
|||
|
|
<?php echo generateOption('first_aid_box', "CONCAT(box_code,'-',box_name)", 'box_id', '', ''); ?>
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
<div class=col-sm-6>
|
|||
|
|
<label>Refilled by<span style="color: red">*</span></label>
|
|||
|
|
<select class="form-control select2" id="filled_by" name="filled_by">
|
|||
|
|
<option disabled selected>Please select option</option>
|
|||
|
|
<?php
|
|||
|
|
// echo getEmployeeOptions();
|
|||
|
|
?>
|
|||
|
|
</select>
|
|||
|
|
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div> -->
|
|||
|
|
<div class="row">
|
|||
|
|
<div class="col-sm-12">
|
|||
|
|
<table id="myTable" class="table table-bordered order-list">
|
|||
|
|
<thead>
|
|||
|
|
<tr>
|
|||
|
|
<th>Item</th>
|
|||
|
|
<th>Batch No</th>
|
|||
|
|
<th>Current Qty</th>
|
|||
|
|
<th>Issued Qty</th>
|
|||
|
|
<th>Item Rate</th>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
<!-- <th>Payment Mode</th> -->
|
|||
|
|
<th>Total Price</th>
|
|||
|
|
<th>GHCL FT Subsidy</th>
|
|||
|
|
<th>Farmer Contribution</th>
|
|||
|
|
|
|||
|
|
|
|||
|
|
<th>Transaction Remarks</th>
|
|||
|
|
<th>Unit</th>
|
|||
|
|
<!-- <th>Issue Details/Remarks</th> -->
|
|||
|
|
<th>Delete</th>
|
|||
|
|
</tr>
|
|||
|
|
</thead>
|
|||
|
|
<tbody id='myBody'>
|
|||
|
|
<?php
|
|||
|
|
$i = 0;
|
|||
|
|
$sql_stock_issue_items = "SELECT * FROM stock_issue_items where stock_issue_id=$stock_issue_id ";
|
|||
|
|
// echo ('xxx' . $sql_stock_issue_items);
|
|||
|
|
$result_stock_issue = @mysqli_query($conn, $sql_stock_issue_items);
|
|||
|
|
if ($stock_issue_id != '' && $stock_issue_id != null) {
|
|||
|
|
while ($row_stock_issue = @mysqli_fetch_assoc($result_stock_issue)) { ?>
|
|||
|
|
<tr>
|
|||
|
|
<td style="width: 15%">
|
|||
|
|
<select class="form-control select2 item_option " id="item_id<?php echo $i ?>" name="item_id<?php echo $i ?>" onchange=" setItemCurrentStock(this.value,'0'); setItemBatchNo(this.value,'0');getUnitForChildItem('child_item_unit',this.value,0)" data-placeholder="Choose a item..." style="width: 100%;">
|
|||
|
|
<option value=""></option>
|
|||
|
|
<?php
|
|||
|
|
// error_log(" tatata ".$row_stock_issue['item_id']);
|
|||
|
|
// echo generate_options("SELECT item_id,trim(concat(ifnull(form_name,''),' ',item_name)) item_name FROM tbl_items i left join medicine_form f on i.item_form_id=f.form_id where status='1' and is_group_item!='P' order by item_name", $row_stock_issue['item_id'], 'item_id', 'item_name', '', '');
|
|||
|
|
?>
|
|||
|
|
<?php echo generate_options("SELECT item_id, item_name FROM tbl_items i left join medicine_form f on i.item_form_id=f.form_id where status='1' and ohc_type_id='" . $_SESSION['current_ohcttype'] . "' ", $row_stock_issue['item_id'], 'item_id', 'item_name', '', ''); ?>
|
|||
|
|
</select>
|
|||
|
|
</td>
|
|||
|
|
<td style="width: 30%"><select name="item_batch_no<?php echo $i ?>" id="item_batch_no<?php echo $i ?>" onchange="chk_duplicate_batch(this.value,<?php echo $i ?>)" class="form-control">
|
|||
|
|
<option disabled>Please Select Batch No</option>
|
|||
|
|
<?php
|
|||
|
|
$sql_stock_item = "select * from item_stock where item_id='" . $row_stock_issue['item_id'] . "' and (stock_qty>0 or item_batch_no='" . $row_stock_issue['item_batch_no'] . "') and ohc_type_id='" . $_SESSION['current_ohcttype'] . "' ";
|
|||
|
|
// echo $sql_stock_item;
|
|||
|
|
$result_stock_item = @mysqli_query($conn, $sql_stock_item);
|
|||
|
|
while ($row_stock_item = mysqli_fetch_assoc($result_stock_item)) {
|
|||
|
|
if ($row_stock_item['item_batch_no'] == $row_stock_issue['item_batch_no']) {
|
|||
|
|
?>
|
|||
|
|
<option selected value="<?php echo $row_stock_item['item_batch_no'] ?>">
|
|||
|
|
<?php echo $row_stock_item['item_batch_no'] . ' (Expiry Date:' . date_format(date_create($row_stock_item['expiry_date']), "d-M-Y ") . ',Stock Qty:' . $row_stock_item['stock_qty'] . ')' ?>
|
|||
|
|
</option>
|
|||
|
|
<?php } else { ?>
|
|||
|
|
<option value="<?php echo $row_stock_item['item_batch_no'] ?>">
|
|||
|
|
<?php echo $row_stock_item['item_batch_no'] . ' (Expiry Date:' . date_format(date_create($row_stock_item['expiry_date']), "d-M-Y ") . ',Stock Qty:' . $row_stock_item['stock_qty'] . ')' ?>
|
|||
|
|
</option>
|
|||
|
|
<?php
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
?>
|
|||
|
|
</select></td>
|
|||
|
|
<td style="width:10%">
|
|||
|
|
<input disabled type="number" name="current_stock0" id="current_stock0" class="form-control" />
|
|||
|
|
</td>
|
|||
|
|
<td style="width: 10%"><input type="hidden" id="old_issue_qty<?php echo $i ?>" name="old_issue_qty<?php echo $i ?>" value="<?php echo $row_stock_issue['issue_qty'] ?>"><input type="number" name="issue_qty<?php echo $i ?>" id="issue_qty<?php echo $i ?>" onchange="check_season_limit(this.value,0)" oninput="chk_issue_qty(this.value,0)" value="<?php echo $row_stock_issue['issue_qty'] ?>" onchange="" class="form-control" /></td>
|
|||
|
|
|
|||
|
|
<td style="width: 10%"><input type="number" name="per_unit_rate<?php echo $i ?>" id="per_unit_rate<?php echo $i ?>" value="<?php echo $row_stock_issue['per_unit_rate'] ?>" class="form-control" /></td>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
<!-- <td style="width:10%">
|
|||
|
|
<select class="form-control" name="payment_method<?php echo $i ?>" id="payment_method<?php echo $i ?>">
|
|||
|
|
<option value="cash" <?php if ($row_stock_issue['payment_method'] == 'cash') echo 'selected' ?>>Cash</option>
|
|||
|
|
<option value="upi" <?php if ($row_stock_issue['payment_method'] == 'cash') echo 'selected' ?>>UPI</option>
|
|||
|
|
</select>
|
|||
|
|
</td> -->
|
|||
|
|
|
|||
|
|
<td style="width: 10%"><input type="number" name="total_rate<?php echo $i ?>" id="total_rate<?php echo $i ?>" value="<?php echo $row_stock_issue['total_rate'] ?>" class="form-control" /></td>
|
|||
|
|
|
|||
|
|
<td style="width: 10%"><input readonly type="hidden" name="subsidy<?php echo $i ?>" id="subsidy<?php echo $i ?>" value="<?php echo $row_stock_issue['subsidy_percent'] / $row_stock_issue['issue_qty'] ?>" class="form-control" /><input readonly type="number" name="subsidy_percent<?php echo $i ?>" id="subsidy_percent<?php echo $i ?>" value="<?php echo $row_stock_issue['subsidy_percent'] ?>" class="form-control" /></td>
|
|||
|
|
|
|||
|
|
<td style="width: 10%"><input type="number" name="payable_price<?php echo $i ?>" id="payable_price<?php echo $i ?>" value="<?php echo $row_stock_issue['payable_price'] ?>" class="form-control" /></td>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
<td style="width:10%">
|
|||
|
|
<input type="text" name="transaction_remarks<?php echo $i ?>" id="transaction_remarks<?php echo $i ?>" class="form-control" value="<?php echo $row_stock_issue['transaction_remarks'] ?>" />
|
|||
|
|
</td>
|
|||
|
|
<td style="width: 8%">
|
|||
|
|
<div id="child_item_unit<?php echo $i ?>"><?php
|
|||
|
|
echo $unitMap[getTableFieldValue('tbl_items', 'unit_id', 'item_id', $row_stock_issue['item_id'])];
|
|||
|
|
?></div>
|
|||
|
|
</td>
|
|||
|
|
<td align="center" style="width: 10%"><?php if ($i > 0) { ?>
|
|||
|
|
<a href="#" class="btn-lg" data-toggle="tooltip" id="deletebtn" title="Delete"><span class="glyphicon glyphicon-trash"></span></a>
|
|||
|
|
<?php } ?>
|
|||
|
|
</td>
|
|||
|
|
</tr>
|
|||
|
|
<?php
|
|||
|
|
$i++;
|
|||
|
|
}
|
|||
|
|
} else { ?>
|
|||
|
|
<tr>
|
|||
|
|
<td style="width:20%">
|
|||
|
|
<!-- <select class="chosen-select form-control" id="item_id0" name="item_id0" data-placeholder="Choose a item..." style="display: none;" onchange="setRequisitionQty(this.value,'0')">-->
|
|||
|
|
<select class="form-control select2 item_option" id="item_id0" name="item_id0" onchange="setItemCurrentStock(this.value,'0'); setItemBatchNo(this.value,'0');getUnitForChildItem('child_item_unit',this.value,0)" data-placeholder="Choose a item..." style="width: 100%;">
|
|||
|
|
<option value=""></option>
|
|||
|
|
<?php
|
|||
|
|
// echo generate_options("SELECT item_id,trim(concat(ifnull(form_name,''),' ',item_name)) item_name FROM tbl_items i left join medicine_form f on i.item_form_id=f.form_id where status='1' and is_group_item!='P' order by item_name", $row_treatment['item_id'], 'item_id', 'item_name', '', '');
|
|||
|
|
?>
|
|||
|
|
<?php echo generate_options("SELECT item_id, item_name FROM tbl_items i left join medicine_form f on i.item_form_id=f.form_id where status='1' and ohc_type_id='" . $_SESSION['current_ohcttype'] . "' and RoleCode = '" . $_SESSION['role_type'] . "' ", $row_stock_issue['item_id'], 'item_id', 'item_name', '', ''); ?>
|
|||
|
|
</select>
|
|||
|
|
</td>
|
|||
|
|
<td style="width:20%">
|
|||
|
|
<select name="item_batch_no0" id="item_batch_no0" onchange="chk_duplicate_batch(this.value,0)" class="form-control">
|
|||
|
|
</select>
|
|||
|
|
</td>
|
|||
|
|
|
|||
|
|
<td style="width:10%">
|
|||
|
|
<input disabled type="number" name="current_stock0" id="current_stock0" class="form-control" />
|
|||
|
|
</td>
|
|||
|
|
<td style="width:10%">
|
|||
|
|
<input style="display: none;" type="number" name="issue_qty0" id="issue_qty0" onchange="check_season_limit(this.value,0)" oninput="chk_issue_qty(this.value,0)" class="form-control" />
|
|||
|
|
<span onclick="get_group_id($('#item_id0').val())" id="group_id0" style="border:none; background:none; cursor:pointer;display: none;"><i class="ace-icon fa fa-archive" style="font-size: 20px;"></i>
|
|||
|
|
</span>
|
|||
|
|
</td>
|
|||
|
|
<td style="width:10%">
|
|||
|
|
<input readonly type="number" name="per_unit_rate0" id="per_unit_rate0" oninput="calculateTotalRate(this.value,0)" class="form-control" />
|
|||
|
|
</td>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
<!-- <td style="width:10%">
|
|||
|
|
<select class="form-control" name="payment_method0" id="payment_method0">
|
|||
|
|
<option value="cash">Cash</option>
|
|||
|
|
<option value="upi">UPI</option>
|
|||
|
|
</select>
|
|||
|
|
</td> -->
|
|||
|
|
<td style="width:10%">
|
|||
|
|
<input readonly type="number" name="total_rate0" id="total_rate0" class="form-control" />
|
|||
|
|
</td>
|
|||
|
|
|
|||
|
|
<td style="width:10%">
|
|||
|
|
<input readonly type="hidden" name="subsidy0" id="subsidy0" value="" class="form-control" />
|
|||
|
|
<input readonly type="number" name="subsidy_percent0" id="subsidy_percent0" oninput="calculateTotalRate(this.value,0)" class="form-control" />
|
|||
|
|
</td>
|
|||
|
|
|
|||
|
|
<td style="width:10%">
|
|||
|
|
<input readonly type="number" name="payable_price0" id="payable_price0" class="form-control" />
|
|||
|
|
</td>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
<td style="width:10%">
|
|||
|
|
<input type="text" name="transaction_remarks0" id="transaction_remarks0" class="form-control" />
|
|||
|
|
</td>
|
|||
|
|
<td style="width:8%">
|
|||
|
|
<div id="child_item_unit0"></div>
|
|||
|
|
</td>
|
|||
|
|
<!-- <td style="width:30%">
|
|||
|
|
<input type="text" name="issue_remarks0" id="issue_remarks0" class="form-control" />
|
|||
|
|
</td> -->
|
|||
|
|
<td style="width:10%">
|
|||
|
|
</td>
|
|||
|
|
</tr>
|
|||
|
|
<?php } ?>
|
|||
|
|
</tbody>
|
|||
|
|
<tfoot>
|
|||
|
|
<tr style="margin-left:10px;">
|
|||
|
|
<td colspan="12" style="text-align: left;">
|
|||
|
|
<input type="button" class="btn btn-lg btn-block " id="addrow" value="Add Row" />
|
|||
|
|
<input type="hidden" name="count_items" id="count_items" value="<?php if ($stock_issue_id != '' && $stock_issue_id != null) echo $i;
|
|||
|
|
else echo 1 ?>" />
|
|||
|
|
</td>
|
|||
|
|
</tr>
|
|||
|
|
<tr>
|
|||
|
|
<td style="text-align: right;">
|
|||
|
|
<strong style="font-size: 12px;font-weight: 300;height: fit-content;">Payment Mode:</strong>
|
|||
|
|
</td>
|
|||
|
|
<td colspan="2">
|
|||
|
|
<select class="form-control" name="payment_method" id="payment_method">
|
|||
|
|
<option value="cash" <?php if ($payment_method == 'cash') echo 'selected' ?>>Cash</option>
|
|||
|
|
<option value="upi" <?php if ($payment_method == 'cash') echo 'selected' ?>>UPI</option>
|
|||
|
|
</select>
|
|||
|
|
|
|||
|
|
</td>
|
|||
|
|
|
|||
|
|
<td colspan="1" style="text-align: right;">
|
|||
|
|
<strong style="font-size: 12px;font-weight: 300;height: fit-content;">Total Price :</strong>
|
|||
|
|
</td>
|
|||
|
|
<td colspan="1">
|
|||
|
|
<input type="number" name="cost_total" id="cost_total" class="form-control" readonly />
|
|||
|
|
</td>
|
|||
|
|
<td colspan="1" style="text-align: right;">
|
|||
|
|
<strong style="font-size: 12px;font-weight: 300;height: fit-content;">Total Subsidy :</strong>
|
|||
|
|
</td>
|
|||
|
|
<td colspan="1">
|
|||
|
|
<input type="number" name="subsidy_total" id="subsidy_total" class="form-control" readonly />
|
|||
|
|
</td>
|
|||
|
|
|
|||
|
|
<td colspan="1" style="text-align: right;">
|
|||
|
|
<strong style="font-size: 12px;font-weight: 300;height: fit-content;">Farmer Total Contribution:</strong>
|
|||
|
|
</td>
|
|||
|
|
<td colspan="5">
|
|||
|
|
<input type="number" name="grand_total" id="grand_total" class="form-control" readonly />
|
|||
|
|
</td>
|
|||
|
|
|
|||
|
|
</tr>
|
|||
|
|
<tr>
|
|||
|
|
|
|||
|
|
</tr>
|
|||
|
|
</tfoot>
|
|||
|
|
</table>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<!-- End box-body-->
|
|||
|
|
<!--box-footer-->
|
|||
|
|
<div class="box-footer" style="text-align: center">
|
|||
|
|
<button class="btn btn-info save_button" type="button" onclick="validate();">
|
|||
|
|
<i class="ace-icon fa fa-floppy-o bigger-110"></i>
|
|||
|
|
Save
|
|||
|
|
</button>
|
|||
|
|
|
|||
|
|
<button class="btn btn-warning" type="reset">
|
|||
|
|
<i class="ace-icon fa fa-undo bigger-110"></i>
|
|||
|
|
Reset
|
|||
|
|
</button>
|
|||
|
|
</div>
|
|||
|
|
<!--End box-footer-->
|
|||
|
|
</form>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<!-- End of page-content -->
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<script>
|
|||
|
|
function getParamters() {
|
|||
|
|
var activityName = $('#activity_name').val();
|
|||
|
|
var beneficiaryId = $('#beneficiary').val();
|
|||
|
|
|
|||
|
|
$.ajax({
|
|||
|
|
url: 'fetch_parameters.php',
|
|||
|
|
type: 'POST',
|
|||
|
|
data: {
|
|||
|
|
beneficiary_id: beneficiaryId,
|
|||
|
|
activity_name: activityName
|
|||
|
|
},
|
|||
|
|
success: function(response) {
|
|||
|
|
|
|||
|
|
$('#dynamic_form_content').html(response);
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (activityName == 2) {
|
|||
|
|
setTimeout(function () {
|
|||
|
|
var hasEmpty = false;
|
|||
|
|
$('#dynamic_form_content').find('input, select, textarea').each(function () {
|
|||
|
|
var val = $(this).val();
|
|||
|
|
if (val === "" || val === null || val === "0") {
|
|||
|
|
hasEmpty = true;
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
if (hasEmpty) {
|
|||
|
|
|
|||
|
|
BootstrapDialog.alert({
|
|||
|
|
title: 'Missing Required Fields',
|
|||
|
|
message: 'Required inputs are not filled. Please fill all inputs before continuing.',
|
|||
|
|
type: BootstrapDialog.TYPE_PRIMARY,
|
|||
|
|
callback: function(result) {
|
|||
|
|
|
|||
|
|
window.location.href = "beneficiary_form.php?id=" + beneficiaryId;
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}, 100);
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
error: function(xhr, status, error) {
|
|||
|
|
console.log('Please Check Beneficiary Details!');
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
// if (beneficiaryId) {
|
|||
|
|
// checkBeneficiaryVerification(beneficiaryId);
|
|||
|
|
// }
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
function checkBeneficiaryVerification(beneficiaryId) {
|
|||
|
|
$.ajax({
|
|||
|
|
url: 'check_verification_status.php',
|
|||
|
|
type: 'POST',
|
|||
|
|
data: {
|
|||
|
|
beneficiary_id: beneficiaryId
|
|||
|
|
},
|
|||
|
|
success: function(response) {
|
|||
|
|
if (response == 1) {
|
|||
|
|
// BootstrapDialog.alert("Beneficiary Verified");
|
|||
|
|
} else {
|
|||
|
|
BootstrapDialog.alert({
|
|||
|
|
title: 'Verification Status',
|
|||
|
|
message: 'Beneficiary Not Verified',
|
|||
|
|
callback: function() {
|
|||
|
|
|
|||
|
|
window.location.href = 'beneficiary_form.php?id=' + beneficiaryId;
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
error: function(xhr, status, error) {
|
|||
|
|
console.log('Error: ' + error);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
$(document).ready(function() {
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
$('#activity_name').click(function() {
|
|||
|
|
myActivityFunction();
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
|
|||
|
|
function myActivityFunction() {
|
|||
|
|
console.log('Activity name clicked!');
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
</script>
|
|||
|
|
<script>
|
|||
|
|
// function checkToTalSubsidy() {
|
|||
|
|
// var activity = $("#activity_name").val();
|
|||
|
|
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
function validate() {
|
|||
|
|
$('.save_button').hide();
|
|||
|
|
var beneficiary = $("#beneficiary").val();
|
|||
|
|
if (beneficiary == null || beneficiary == '') {
|
|||
|
|
BootstrapDialog.alert('Please Select Beneficiary!');
|
|||
|
|
$('.save_button').show();
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
var activity_name = $("#activity_name").val();
|
|||
|
|
if (activity_name == null || activity_name == '') {
|
|||
|
|
BootstrapDialog.alert('Please Select Activity!');
|
|||
|
|
$('.save_button').show();
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
var distribution_vendor = $("#distribution_vendor").val();
|
|||
|
|
if (distribution_vendor == null || distribution_vendor == '') {
|
|||
|
|
BootstrapDialog.alert('Please Select Agency!');
|
|||
|
|
$('.save_button').show();
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
var item_id0 = $("#item_id0").val();
|
|||
|
|
if (item_id0 == null || item_id0 == '') {
|
|||
|
|
BootstrapDialog.alert('Please Select Item Name!');
|
|||
|
|
$('.save_button').show();
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var issue_qty0 = $("#issue_qty0").val();
|
|||
|
|
if (issue_qty0 == null || issue_qty0 == '') {
|
|||
|
|
BootstrapDialog.alert('Please Enter Issue!');
|
|||
|
|
$('.save_button').show();
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var animal = $("#animal").val();
|
|||
|
|
if (animal == null || animal == '') {
|
|||
|
|
BootstrapDialog.alert('Please Enter Animal!');
|
|||
|
|
$('.save_button').show();
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
var animal_type = $("#animal_type").val();
|
|||
|
|
if (animal_type == null || animal_type == '') {
|
|||
|
|
BootstrapDialog.alert('Please Enter Animal Type!');
|
|||
|
|
$('.save_button').show();
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
var diagnosis = $("#diagnosis").val();
|
|||
|
|
if (diagnosis == null || diagnosis == '') {
|
|||
|
|
BootstrapDialog.alert('Please Select diagnosis!');
|
|||
|
|
$('.save_button').show();
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
$.ajax({
|
|||
|
|
url: 'select_activity_rules.php',
|
|||
|
|
type: "POST",
|
|||
|
|
async: false,
|
|||
|
|
data: $("#direct_item_issue").serialize(),
|
|||
|
|
success: function(data) {
|
|||
|
|
if (data != '' && data != null) {
|
|||
|
|
BootstrapDialog.alert(data);
|
|||
|
|
$('.save_button').show();
|
|||
|
|
return false;
|
|||
|
|
} else {
|
|||
|
|
|
|||
|
|
$.ajax({
|
|||
|
|
url: 'select_item_rules_new.php',
|
|||
|
|
type: "POST",
|
|||
|
|
async: false,
|
|||
|
|
data: $("#direct_item_issue").serialize(),
|
|||
|
|
|
|||
|
|
success: function(respons) {
|
|||
|
|
if (respons != '' && respons != null) {
|
|||
|
|
BootstrapDialog.alert(respons);
|
|||
|
|
$('.save_button').show();
|
|||
|
|
return false;
|
|||
|
|
} else {
|
|||
|
|
var count = $("#count_items").val();
|
|||
|
|
var batch_checker = 0;
|
|||
|
|
var not_selected_batch = "";
|
|||
|
|
for (var i = 0; i < count; i++) {
|
|||
|
|
var item_id = $("#item_id" + i).val();
|
|||
|
|
var batch = $("#item_batch_no" + i).val();
|
|||
|
|
if (item_id == null || item_id == '') {
|
|||
|
|
continue;
|
|||
|
|
} else {
|
|||
|
|
$.ajax({
|
|||
|
|
url: 'select_item_batch_need.php',
|
|||
|
|
async: false,
|
|||
|
|
type: "POST",
|
|||
|
|
data: {
|
|||
|
|
item_id: item_id,
|
|||
|
|
},
|
|||
|
|
dataType: 'JSON',
|
|||
|
|
success: function(data) {
|
|||
|
|
if (data.batch_need == 1) {
|
|||
|
|
if (batch == null || batch == '') {
|
|||
|
|
batch_checker = 1;
|
|||
|
|
// alert(batch_checker);
|
|||
|
|
not_selected_batch += $("#item_id" + i + " option:selected").text() + " ,";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
error: function(data) {
|
|||
|
|
BootstrapDialog.alert('Error pulling Item Details');
|
|||
|
|
$('.save_button').show();
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (batch_checker != 0) {
|
|||
|
|
BootstrapDialog.alert('Please select batch of ' + not_selected_batch + ' !!!');
|
|||
|
|
$('.save_button').show();
|
|||
|
|
return false;
|
|||
|
|
} else {
|
|||
|
|
// alert('save');
|
|||
|
|
save();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
error: function(respons) {
|
|||
|
|
BootstrapDialog.alert('Error pulling Item Details');
|
|||
|
|
$('.save_button').show();
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
},
|
|||
|
|
error: function(data) {
|
|||
|
|
BootstrapDialog.alert('Error pulling Item Details');
|
|||
|
|
$('.save_button').show();
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function get_group_id(item_id) {
|
|||
|
|
// Open the modal
|
|||
|
|
$('#groupItemsModal').modal('show');
|
|||
|
|
|
|||
|
|
$('#itemName').val('Item ' + item_id);
|
|||
|
|
|
|||
|
|
$.ajax({
|
|||
|
|
url: 'fetch_group_items.php',
|
|||
|
|
type: 'POST',
|
|||
|
|
data: {
|
|||
|
|
item_id: item_id
|
|||
|
|
},
|
|||
|
|
success: function(response) {
|
|||
|
|
// Assuming 'response' is a JSON array of objects with 'item_id', 'item_name', and 'qty'
|
|||
|
|
let items = JSON.parse(response);
|
|||
|
|
let tbody = $('#itemsTable tbody');
|
|||
|
|
tbody.empty(); // Clear existing rows
|
|||
|
|
var count = 1;
|
|||
|
|
items.forEach(function(item) {
|
|||
|
|
let selectId = 'g_item_' + count;
|
|||
|
|
let uniqueId = 'qty_' + item.item_id; // Define a unique ID for the input field
|
|||
|
|
|
|||
|
|
let row = `<tr>
|
|||
|
|
<td>
|
|||
|
|
${item.item_name}
|
|||
|
|
</td>
|
|||
|
|
<td>
|
|||
|
|
${item.qty} ${item.unit_name}
|
|||
|
|
</td>
|
|||
|
|
</tr>`;
|
|||
|
|
tbody.append(row);
|
|||
|
|
count++;
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
error: function(xhr, status, error) {
|
|||
|
|
console.error('Error fetching group items:', error);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
function calculateGrandTotal() {
|
|||
|
|
var grandTotal = 0;
|
|||
|
|
|
|||
|
|
$("input[name^='payable_price']").each(function() {
|
|||
|
|
var totalRate = parseFloat($(this).val()) || 0;
|
|||
|
|
grandTotal += totalRate;
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
$("#grand_total").val(grandTotal.toFixed(2));
|
|||
|
|
//
|
|||
|
|
var subsidyTotal = 0;
|
|||
|
|
|
|||
|
|
$("input[name^='subsidy_percent']").each(function() {
|
|||
|
|
var subsidyRate = parseFloat($(this).val()) || 0;
|
|||
|
|
subsidyTotal += subsidyRate;
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
$("#subsidy_total").val(subsidyTotal.toFixed(2));
|
|||
|
|
//
|
|||
|
|
var costTotal = 0;
|
|||
|
|
|
|||
|
|
$("input[name^='total_rate']").each(function() {
|
|||
|
|
// alert($(this).val());
|
|||
|
|
var costRate = parseFloat($(this).val()) || 0;
|
|||
|
|
costTotal += costRate;
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
$("#cost_total").val(costTotal.toFixed(2));
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
function calculateTotalRate(value, index) {
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
var perUnitRate = parseFloat(document.getElementById('per_unit_rate' + index).value) || 0;
|
|||
|
|
var issueQty = parseFloat(document.getElementById('issue_qty' + index).value) || 0;
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
var totalRate = perUnitRate * issueQty;
|
|||
|
|
|
|||
|
|
var subsidy_percent = $("#subsidy" + index).val();
|
|||
|
|
var subsicy_price = subsidy_percent * issueQty;
|
|||
|
|
|
|||
|
|
var payable_price = totalRate - subsicy_price;
|
|||
|
|
document.getElementById('subsidy_percent' + index).value = subsicy_price.toFixed(2);
|
|||
|
|
document.getElementById('payable_price' + index).value = payable_price.toFixed(2);
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
document.getElementById('total_rate' + index).value = totalRate.toFixed(2);
|
|||
|
|
calculateGrandTotal();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function chk_issue_qty(value, count) {
|
|||
|
|
|
|||
|
|
calculateTotalRate(value, count)
|
|||
|
|
var issue_qty = eval($("#issue_qty" + count).val());
|
|||
|
|
var item_id = $("#item_id" + count).val();
|
|||
|
|
var batch_no = $("#item_batch_no" + count).val();
|
|||
|
|
var batch_qty = '';
|
|||
|
|
$("#check_item").val(item_id);
|
|||
|
|
$("#check_qty").val(issue_qty);
|
|||
|
|
|
|||
|
|
|
|||
|
|
$.ajax({
|
|||
|
|
url: 'select_item_stock.php',
|
|||
|
|
type: "POST",
|
|||
|
|
data: {
|
|||
|
|
item_id: item_id,
|
|||
|
|
item_batch_no: batch_no
|
|||
|
|
},
|
|||
|
|
success: function(data) {
|
|||
|
|
// var old_qty=$('#old_issue_qty'+count).val();
|
|||
|
|
|
|||
|
|
var batch_qty = parseInt(JSON.parse(data));
|
|||
|
|
// if(old_qty!='' && old_qty!=null){
|
|||
|
|
// batch_qty+= parseInt(old_qty)
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
// alert(old_qty)
|
|||
|
|
$("#current_stock" + count).val(parseInt(batch_qty));
|
|||
|
|
console.log(batch_qty);
|
|||
|
|
if (issue_qty > batch_qty) {
|
|||
|
|
BootstrapDialog.alert('Issue quantity cannot be greater than available batch quantity');
|
|||
|
|
$("#issue_qty" + count).val("");
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
error: function(data) {
|
|||
|
|
BootstrapDialog.alert('Error pulling Item Details');
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function check_season_limit(value, count) {
|
|||
|
|
$.ajax({
|
|||
|
|
url: 'check_item_season_limit.php',
|
|||
|
|
type: "POST",
|
|||
|
|
data: $("#direct_item_issue").serialize(),
|
|||
|
|
success: function(respons) {
|
|||
|
|
if (respons != '' && respons != null) {
|
|||
|
|
BootstrapDialog.alert(respons);
|
|||
|
|
$("#issue_qty" + count).val("");
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
},
|
|||
|
|
error: function(data) {
|
|||
|
|
BootstrapDialog.alert('Error pulling Item Details');
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function chk_duplicate_batch(value, count) {
|
|||
|
|
var batch_no = $("#item_batch_no" + count).val();
|
|||
|
|
var item_id_no = $("#item_id" + count).val();
|
|||
|
|
var total_count = $("#count_items").val();
|
|||
|
|
for (var i = 0; i < total_count; i++) {
|
|||
|
|
if (i == count) {
|
|||
|
|
continue;
|
|||
|
|
} else {
|
|||
|
|
var batch = $("#item_batch_no" + i).val();
|
|||
|
|
var item_id = $("#item_id" + i).val();
|
|||
|
|
if (batch == '' || batch == null || batch_no == '' || batch_no == null) {
|
|||
|
|
continue;
|
|||
|
|
}
|
|||
|
|
if ((batch_no == batch) && (item_id_no == item_id)) {
|
|||
|
|
BootstrapDialog.alert('You cannot select same batch again!!!!');
|
|||
|
|
$("#item_batch_no" + count).val("");
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
</script>
|
|||
|
|
<script>
|
|||
|
|
showOrHideForDiv($("#ohc_loc").val());
|
|||
|
|
|
|||
|
|
function showOrHideForDiv(value) {
|
|||
|
|
if (value == "3")
|
|||
|
|
$("#ambulance_div").show(), $("#box_div1").hide();
|
|||
|
|
else if (value == "4")
|
|||
|
|
$("#box_div1").show(), $("#ambulance_div").hide();
|
|||
|
|
else
|
|||
|
|
$("#box_div1").hide(), $("#ambulance_div").hide();
|
|||
|
|
}
|
|||
|
|
</script>
|
|||
|
|
<style>
|
|||
|
|
#modal-add-ailment {
|
|||
|
|
overflow-y: scroll;
|
|||
|
|
}
|
|||
|
|
</style>
|
|||
|
|
<?php include('techsyn_footer.php'); ?>
|
|||
|
|
<script type="text/javascript">
|
|||
|
|
jQuery(function($) {
|
|||
|
|
var myTable =
|
|||
|
|
$('#dynamic-table')
|
|||
|
|
.DataTable({
|
|||
|
|
bAutoWidth: false,
|
|||
|
|
"aoColumns": [{
|
|||
|
|
"bSortable": false
|
|||
|
|
},
|
|||
|
|
null, null, null, null, null,
|
|||
|
|
{
|
|||
|
|
"bSortable": false
|
|||
|
|
}
|
|||
|
|
],
|
|||
|
|
"aaSorting": [],
|
|||
|
|
select: {
|
|||
|
|
style: 'multi'
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
var defaultCopyAction = myTable.button(1).action();
|
|||
|
|
myTable.button(1).action(function(e, dt, button, config) {
|
|||
|
|
defaultCopyAction(e, dt, button, config);
|
|||
|
|
$('.dt-button-info').addClass('gritter-item-wrapper gritter-info gritter-center white');
|
|||
|
|
});
|
|||
|
|
var defaultColvisAction = myTable.button(0).action();
|
|||
|
|
myTable.button(0).action(function(e, dt, button, config) {
|
|||
|
|
defaultColvisAction(e, dt, button, config);
|
|||
|
|
if ($('.dt-button-collection > .dropdown-menu').length == 0) {
|
|||
|
|
$('.dt-button-collection')
|
|||
|
|
.wrapInner('<ul class="dropdown-menu dropdown-light dropdown-caret dropdown-caret" />')
|
|||
|
|
.find('a').attr('href', '#').wrap("<li />")
|
|||
|
|
}
|
|||
|
|
$('.dt-button-collection').appendTo('.tableTools-container .dt-buttons')
|
|||
|
|
});
|
|||
|
|
setTimeout(function() {
|
|||
|
|
$($('.tableTools-container')).find('a.dt-button').each(function() {
|
|||
|
|
var div = $(this).find(' > div').first();
|
|||
|
|
if (div.length == 1) div.tooltip({
|
|||
|
|
container: 'body',
|
|||
|
|
title: div.parent().text()
|
|||
|
|
});
|
|||
|
|
else $(this).tooltip({
|
|||
|
|
container: 'body',
|
|||
|
|
title: $(this).text()
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
}, 500);
|
|||
|
|
myTable.on('select', function(e, dt, type, index) {
|
|||
|
|
if (type === 'row') {
|
|||
|
|
$(myTable.row(index).node()).find('input:checkbox').prop('checked', true);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
myTable.on('deselect', function(e, dt, type, index) {
|
|||
|
|
if (type === 'row') {
|
|||
|
|
$(myTable.row(index).node()).find('input:checkbox').prop('checked', false);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
$('th input[type=checkbox], td input[type=checkbox]').prop('checked', false);
|
|||
|
|
$('#dynamic-table > thead > tr > th input[type=checkbox], #dynamic-table_wrapper input[type=checkbox]').eq(
|
|||
|
|
0).on('click', function() {
|
|||
|
|
var th_checked = this.checked;
|
|||
|
|
$('#dynamic-table').find('tbody > tr').each(function() {
|
|||
|
|
var row = this;
|
|||
|
|
if (th_checked) myTable.row(row).select();
|
|||
|
|
else myTable.row(row).deselect();
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
$('#dynamic-table').on('click', 'td input[type=checkbox]', function() {
|
|||
|
|
var row = $(this).closest('tr').get(0);
|
|||
|
|
if (this.checked) myTable.row(row).deselect();
|
|||
|
|
else myTable.row(row).select();
|
|||
|
|
});
|
|||
|
|
$(document).on('click', '#dynamic-table .dropdown-toggle', function(e) {
|
|||
|
|
e.stopImmediatePropagation();
|
|||
|
|
e.stopPropagation();
|
|||
|
|
e.preventDefault();
|
|||
|
|
});
|
|||
|
|
var active_class = 'active';
|
|||
|
|
$('#simple-table > thead > tr > th input[type=checkbox]').eq(0).on('click', function() {
|
|||
|
|
var th_checked = this.checked;
|
|||
|
|
$(this).closest('table').find('tbody > tr').each(function() {
|
|||
|
|
var row = this;
|
|||
|
|
if (th_checked) $(row).addClass(active_class).find('input[type=checkbox]').eq(0)
|
|||
|
|
.prop('checked', true);
|
|||
|
|
else $(row).removeClass(active_class).find('input[type=checkbox]').eq(0).prop(
|
|||
|
|
'checked', false);
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
$('#simple-table').on('click', 'td input[type=checkbox]', function() {
|
|||
|
|
var $row = $(this).closest('tr');
|
|||
|
|
if ($row.is('.detail-row ')) return;
|
|||
|
|
if (this.checked) $row.addClass(active_class);
|
|||
|
|
else $row.removeClass(active_class);
|
|||
|
|
});
|
|||
|
|
$('[data-rel="tooltip"]').tooltip({
|
|||
|
|
placement: tooltip_placement
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
function tooltip_placement(context, source) {
|
|||
|
|
var $source = $(source);
|
|||
|
|
var $parent = $source.closest('table')
|
|||
|
|
var off1 = $parent.offset();
|
|||
|
|
var w1 = $parent.width();
|
|||
|
|
var off2 = $source.offset();
|
|||
|
|
if (parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2)) return 'right';
|
|||
|
|
return 'left';
|
|||
|
|
}
|
|||
|
|
/***************/
|
|||
|
|
$('.show-details-btn').on('click', function(e) {
|
|||
|
|
e.preventDefault();
|
|||
|
|
$(this).closest('tr').next().toggleClass('open');
|
|||
|
|
$(this).find(ace.vars['.icon']).toggleClass('fa-angle-double-down').toggleClass(
|
|||
|
|
'fa-angle-double-up');
|
|||
|
|
});
|
|||
|
|
/***************/
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
function save() {
|
|||
|
|
$.ajax({
|
|||
|
|
url: 'save_vet_item_issue_new.php',
|
|||
|
|
type: "POST",
|
|||
|
|
data: $("#direct_item_issue").serialize(),
|
|||
|
|
dataType: 'json',
|
|||
|
|
success: function(data) { //alert(data);
|
|||
|
|
if (data.stock_issue_id != null && data.stock_issue_id != "")
|
|||
|
|
$("#stock_issue_id").val(data.stock_issue_id);
|
|||
|
|
|
|||
|
|
//BootstrapDialog.alert('Item Issue Saved Successfully.');
|
|||
|
|
BootstrapDialog.show({
|
|||
|
|
title: 'Information',
|
|||
|
|
message: 'Direct Item Issue Saved Successfully.',
|
|||
|
|
buttons: [{
|
|||
|
|
label: 'OK',
|
|||
|
|
action: function(dialog) {
|
|||
|
|
|
|||
|
|
location.href = "veterinary_issue_list_new.php?pagekey=198";
|
|||
|
|
}
|
|||
|
|
}]
|
|||
|
|
});
|
|||
|
|
$('.save_button').show();
|
|||
|
|
return;
|
|||
|
|
},
|
|||
|
|
error: function(data) {
|
|||
|
|
BootstrapDialog.alert('Error In Saving Direct Item Issue');
|
|||
|
|
$('.save_button').show();
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
//$('.close').click();
|
|||
|
|
//location.href="add_item_issue.php";
|
|||
|
|
}
|
|||
|
|
$('.date-picker').datepicker({
|
|||
|
|
autoclose: true,
|
|||
|
|
format: 'dd/mm/yyyy'
|
|||
|
|
}).next().on(ace.click_event, function() {
|
|||
|
|
$(this).prev().focus();
|
|||
|
|
});
|
|||
|
|
// do something<6E>
|
|||
|
|
</script>
|
|||
|
|
<!-- bootstrap & fontawesome -->
|
|||
|
|
<link rel="stylesheet" href="assets/font-awesome/4.5.0/css/font-awesome.min.css" />
|
|||
|
|
<!-- page specific plugin styles -->
|
|||
|
|
<link rel="stylesheet" href="assets/css/jquery-ui.custom.min.css" />
|
|||
|
|
<link rel="stylesheet" href="assets/css/chosen.min.css" />
|
|||
|
|
<link rel="stylesheet" href="assets/css/bootstrap-datepicker3.min.css" />
|
|||
|
|
<link rel="stylesheet" href="assets/css/bootstrap-timepicker.min.css" />
|
|||
|
|
<link rel="stylesheet" href="assets/css/daterangepicker.min.css" />
|
|||
|
|
<link rel="stylesheet" href="assets/css/bootstrap-datetimepicker.min.css" />
|
|||
|
|
<link rel="stylesheet" href="assets/css/bootstrap-colorpicker.min.css" />
|
|||
|
|
<script type="text/javascript" src="js/typeahead.bundle.js"></script>
|
|||
|
|
<script src="assets/js/jquery-ui.custom.min.js"></script>
|
|||
|
|
<script src="assets/js/jquery.ui.touch-punch.min.js"></script>
|
|||
|
|
<script src="assets/js/chosen.jquery.min.js"></script>
|
|||
|
|
<script src="assets/js/spinbox.min.js"></script>
|
|||
|
|
<script src="assets/js/bootstrap-datepicker.min.js"></script>
|
|||
|
|
<script src="assets/js/bootstrap-timepicker.min.js"></script>
|
|||
|
|
<script src="assets/js/jquery.dataTables.min.js"></script>
|
|||
|
|
<script src="assets/js/jquery.dataTables.bootstrap.min.js"></script>
|
|||
|
|
<script src="assets/js/dataTables.buttons.min.js"></script>
|
|||
|
|
<script src="assets/js/buttons.flash.min.js"></script>
|
|||
|
|
<script src="assets/js/buttons.html5.min.js"></script>
|
|||
|
|
<script src="assets/js/buttons.print.min.js"></script>
|
|||
|
|
<script src="assets/js/buttons.colVis.min.js"></script>
|
|||
|
|
<script src="assets/js/dataTables.select.min.js"></script>
|
|||
|
|
<script src="assets/js/moment.min.js"></script>
|
|||
|
|
<script src="assets/js/daterangepicker.min.js"></script>
|
|||
|
|
<script src="assets/js/bootstrap-datetimepicker.min.js"></script>
|
|||
|
|
<script src="assets/js/bootstrap-colorpicker.min.js"></script>
|
|||
|
|
<script src="assets/js/jquery.knob.min.js"></script>
|
|||
|
|
<script src="assets/js/autosize.min.js"></script>
|
|||
|
|
<script src="assets/js/jquery.inputlimiter.min.js"></script>
|
|||
|
|
<script src="assets/js/jquery.maskedinput.min.js"></script>
|
|||
|
|
<script src="assets/js/bootstrap-tag.min.js"></script>
|
|||
|
|
<script src="assets/js/ace-elements.min.js"></script>
|
|||
|
|
<script type="text/javascript">
|
|||
|
|
function myDateFormaterMonthYear(myDate) {
|
|||
|
|
var d = new Date(myDate);
|
|||
|
|
var m = d.getMonth() + 1;
|
|||
|
|
var y = d.getFullYear();
|
|||
|
|
var date = d.getDate();
|
|||
|
|
// alert(date+"/"+m+"/"+y);
|
|||
|
|
return m + "/" + y;
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
var requisition_items = "";
|
|||
|
|
var content = "";
|
|||
|
|
|
|||
|
|
function getRequisitionItem(req_id) {
|
|||
|
|
$.ajax({
|
|||
|
|
url: 'get_requisition_items.php',
|
|||
|
|
type: 'POST',
|
|||
|
|
data: {
|
|||
|
|
req_id: req_id
|
|||
|
|
},
|
|||
|
|
dataType: 'json',
|
|||
|
|
success: function(data) {
|
|||
|
|
content = "<option ></option>";
|
|||
|
|
if (data != null && data != "") {
|
|||
|
|
requisition_items = data;
|
|||
|
|
for (var i = 0; i < data.length; i++) {
|
|||
|
|
content += "<option value='" + data[i].item_id + "'>" + data[i].item_name + "</option>"
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
$("#item_id0").html(content);
|
|||
|
|
$("#item_id0").trigger("chosen:updated");
|
|||
|
|
},
|
|||
|
|
error: function(data) {}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
var item_batch = "";
|
|||
|
|
|
|||
|
|
function setQtyAgainstBatch(batch_no, count) {
|
|||
|
|
if (item_batch != null && item_batch != "") {
|
|||
|
|
for (var i = 0; i < item_batch.length; i++) {
|
|||
|
|
if (item_batch[i].item_batch_no == batch_no)
|
|||
|
|
$("#stock_qty" + count).val(item_batch[i].stock_in_qty - item_batch[i].stock_out_qty);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function setItemBatchNo(item_id, count) {
|
|||
|
|
$.ajax({
|
|||
|
|
url: 'get_item_batch_nos.php',
|
|||
|
|
type: 'POST',
|
|||
|
|
data: {
|
|||
|
|
item_id: item_id
|
|||
|
|
},
|
|||
|
|
dataType: 'json',
|
|||
|
|
success: function(data) {
|
|||
|
|
var content_item_batch =
|
|||
|
|
"<option value=\"\" selected >Please Select Batch No</option>";
|
|||
|
|
if (data != null && data != "") {
|
|||
|
|
item_batch = data;
|
|||
|
|
for (var i = 0; i < data.length; i++) {
|
|||
|
|
content_item_batch += "<option ";
|
|||
|
|
if (i == 0) content_item_batch += " selected ";
|
|||
|
|
content_item_batch += "value='" + data[i].item_batch_no + "'>" + data[i]
|
|||
|
|
.item_batch_no + " (Expiry Date:" + myDateFormaterMonthYear(data[i].expiry_date) +
|
|||
|
|
", Stock Qty:" + data[i].stock_qty + ")</option>"
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
$("#item_batch_no" + count).html(content_item_batch);
|
|||
|
|
},
|
|||
|
|
error: function(data) {}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function setItemCurrentStock(item_id, count) {
|
|||
|
|
var counter = $("#count_items").val();
|
|||
|
|
|
|||
|
|
|
|||
|
|
for (var i = 0; i < counter; i++) {
|
|||
|
|
// alert(i+'--'+count);
|
|||
|
|
if (i != count) {
|
|||
|
|
var curr_item = $('#item_id' + i).val();
|
|||
|
|
if (curr_item != '' && curr_item != null && curr_item == item_id) {
|
|||
|
|
BootstrapDialog.alert('This Item Alraedy Selected! Please Select Another Item!');
|
|||
|
|
$('#item_id' + count).val('');
|
|||
|
|
$('.select2').select2();
|
|||
|
|
$('.save_button').show();
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$.ajax({
|
|||
|
|
url: 'get_item_current_stock.php',
|
|||
|
|
type: 'POST',
|
|||
|
|
data: {
|
|||
|
|
item_id: item_id
|
|||
|
|
},
|
|||
|
|
dataType: 'json',
|
|||
|
|
async: false,
|
|||
|
|
success: function(data) {
|
|||
|
|
var old_qty = $('#old_issue_qty' + count).val();
|
|||
|
|
|
|||
|
|
var current_stock = parseInt(data.current_stock);
|
|||
|
|
if (old_qty != '' && old_qty != null) {
|
|||
|
|
current_stock += parseInt(old_qty)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
$("#current_stock" + count).val(current_stock);
|
|||
|
|
|
|||
|
|
|
|||
|
|
$("#per_unit_rate" + count).val(data.per_unit_rate);
|
|||
|
|
$("#subsidy_percent" + count).val(data.subsidy_percent);
|
|||
|
|
$("#subsidy" + count).val(data.subsidy_percent);
|
|||
|
|
// alert(data.get_group_id)
|
|||
|
|
if (data.get_group_id) {
|
|||
|
|
$("#group_id" + count).show();
|
|||
|
|
$("#issue_qty" + count).hide();
|
|||
|
|
$("#total_rate" + count).val(data.total_rate);
|
|||
|
|
$("#subsidy_percent" + count).val(data.subsidy_percent);
|
|||
|
|
$("#subsidy" + count).val(data.subsidy_percent);
|
|||
|
|
$("#payable_price" + count).val(data.payable_price);
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
} else {
|
|||
|
|
$("#issue_qty" + count).show();
|
|||
|
|
$("#group_id" + count).hide();
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
},
|
|||
|
|
error: function(data) {}
|
|||
|
|
});
|
|||
|
|
getQty(item_id, count);
|
|||
|
|
}
|
|||
|
|
/*function setRequisitionQty(item_id,count){
|
|||
|
|
if(requisition_items!=null && requisition_items!=""){
|
|||
|
|
for(var i=0;i<requisition_items.length;i++){
|
|||
|
|
if(requisition_items[i].item_id==item_id){
|
|||
|
|
$("#req_qty"+count).html(requisition_items[i].qty-requisition_items[i].issue_qty);
|
|||
|
|
$("#issue_qty"+count).val(requisition_items[i].qty-requisition_items[i].issue_qty);
|
|||
|
|
$("#req_item_id"+count).val(requisition_items[i].req_item_id);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}*/
|
|||
|
|
$(document).ready(function() {
|
|||
|
|
var counter = $("#count_items").val();
|
|||
|
|
// var itemOptions =
|
|||
|
|
|
|||
|
|
// `<?php echo generate_options("SELECT item_id, item_name FROM tbl_items i left join medicine_form f on i.item_form_id=f.form_id where status='1' and ohc_type_id='" . $_SESSION['current_ohcttype'] . "' and RoleCode = '" . $_SESSION['role_type'] . "' ", $row_stock_issue['item_id'], 'item_id', 'item_name', '', ''); ?>`
|
|||
|
|
|
|||
|
|
|
|||
|
|
var itemOptions =
|
|||
|
|
|
|||
|
|
`<?php echo generate_options("SELECT item_id,item_name FROM tbl_items i left join medicine_form f on i.item_form_id=f.form_id where status='1' and ohc_type_id='" . $_SESSION['current_ohcttype'] . "' ", $row_stock_issue['item_id'], 'item_id', 'item_name', '', ''); ?>`
|
|||
|
|
|
|||
|
|
|
|||
|
|
$("#addrow").on("click", function() {
|
|||
|
|
|
|||
|
|
var newRow = $("<tr>");
|
|||
|
|
var cols = "";
|
|||
|
|
var select_treatment = "";
|
|||
|
|
select_treatment += "<select ";
|
|||
|
|
select_treatment += "id=\"item_id" + counter + "\"name=\"item_id" + counter +
|
|||
|
|
"\" data-placeholder=\"Choose a item...\" class=\"form-control item_option select2\" ";
|
|||
|
|
//select_treatment+="style=\"display: none;\"";
|
|||
|
|
select_treatment += " onchange=\"setItemCurrentStock(this.value," + counter +
|
|||
|
|
"); setItemBatchNo(this.value," + counter +
|
|||
|
|
");getUnitForChildItem('child_item_unit',this.value," + counter +
|
|||
|
|
")\" style=\"width: 100%;\">";
|
|||
|
|
select_treatment += "<option value=\"\"> </option>";
|
|||
|
|
select_treatment += itemOptions
|
|||
|
|
select_treatment += "</select>";
|
|||
|
|
cols += '<td>' + select_treatment + '</td><input type=\"hidden\" name="req_item_id' + counter +
|
|||
|
|
'" id="req_item_id' + counter + '" class="form-control"/>';
|
|||
|
|
cols += '<td><select class="form-control" id="item_batch_no' + counter +
|
|||
|
|
'" name="item_batch_no' + counter + '" onchange=\"chk_duplicate_batch(this.value,' +
|
|||
|
|
counter + ')\"></select></td>';
|
|||
|
|
|
|||
|
|
cols += `<td style="width:10%"><input disabled type="number" name="current_stock` + counter +
|
|||
|
|
`" id="current_stock` + counter + `" class="form-control" />
|
|||
|
|
</td>`
|
|||
|
|
cols += '<td><input type="number" class="form-control" id="issue_qty' + counter +
|
|||
|
|
'" name="issue_qty' + counter + '" onchange=\"check_season_limit(this.value,' + counter + ')\" oninput=\"chk_issue_qty(this.value,' + counter +
|
|||
|
|
')\"/></td>';
|
|||
|
|
cols += `<td style="width:10%"><input readonly type="number" name="per_unit_rate` + counter +
|
|||
|
|
`" id="per_unit_rate` + counter + `" onchange=\"calculateTotalRate(this.value,'` +
|
|||
|
|
counter + `')\" class="form-control" />
|
|||
|
|
</td>`
|
|||
|
|
|
|||
|
|
|
|||
|
|
// cols += `<td style="width:10%"><select class="form-control" name="payment_method` + counter + `" id="payment_method` + counter + `">
|
|||
|
|
// <option value="cash">Cash</option>
|
|||
|
|
// <option value="upi">UPI</option>
|
|||
|
|
// </select>
|
|||
|
|
// </td>`
|
|||
|
|
cols += `<td style="width:10%"><input readonly type="number" name="total_rate` + counter +
|
|||
|
|
`" id="total_rate` + counter + `" onchange=\"calculateTotalRate(0)\" class="form-control" />
|
|||
|
|
</td>`
|
|||
|
|
cols += `<td style="width:10%"><input readonly type="hidden" name="subsidy` + counter + `" id="subsidy` + counter + `" value="" class="form-control" /><input readonly type="number" name="subsidy_percent` + counter +
|
|||
|
|
`" id="subsidy_percent` + counter + `" onchange=\"dipak(this.value,'` +
|
|||
|
|
counter + `')\" class="form-control" />
|
|||
|
|
</td>`
|
|||
|
|
|
|||
|
|
cols += `<td style="width:10%"><input readonly type="number" name="payable_price` + counter +
|
|||
|
|
`" id="payable_price` + counter + `" onchange=\"dipak(0)\" class="form-control" />
|
|||
|
|
</td>`
|
|||
|
|
|
|||
|
|
|
|||
|
|
cols += `<td style="width:10%"><input type="text" name="transaction_remarks` + counter +
|
|||
|
|
`" id="transaction_remarks` + counter + `" class="form-control" />
|
|||
|
|
</td>`
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
cols += '<td><div id=\"child_item_unit' + counter + '" ></div></td>';
|
|||
|
|
// cols += '<td><input type="text" class="form-control" id="issue_remarks' + counter + '" name="issue_remarks' + counter + '" /></td>';
|
|||
|
|
cols +=
|
|||
|
|
'<td align="center"><a href="#" class="btn-lg" data-toggle="tooltip" id="deletebtn" title="Delete"><span class="glyphicon glyphicon-trash"></span></a></td>';
|
|||
|
|
newRow.append(cols);
|
|||
|
|
$("table.order-list").append(newRow);
|
|||
|
|
filterItems();
|
|||
|
|
//$('#item_id'+counter).chosen({allow_single_deselect:true});
|
|||
|
|
//$('#item_id'+counter).next().css({'width': $('#item_id'+counter).parent().width()});
|
|||
|
|
counter++;
|
|||
|
|
$('.select2').select2()
|
|||
|
|
$("#count_items").val(counter);
|
|||
|
|
$('.date-picker').datepicker({
|
|||
|
|
autoclose: true,
|
|||
|
|
todayHighlight: true
|
|||
|
|
})
|
|||
|
|
});
|
|||
|
|
$("table.order-list").on("click", "#deletebtn", function(event) {
|
|||
|
|
$(this).closest("tr").remove();
|
|||
|
|
/*counter -= 1
|
|||
|
|
$("#count_items").val(counter);*/
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
</script>
|
|||
|
|
<link rel="stylesheet" href="css/select2.min.css">
|
|||
|
|
<script src="js/select2.full.min.js"></script>
|
|||
|
|
<script type="text/javascript">
|
|||
|
|
jQuery(function($) {
|
|||
|
|
$('.select2').select2()
|
|||
|
|
$('#id-disable-check').on('click', function() {
|
|||
|
|
var inp = $('#form-input-readonly').get(0);
|
|||
|
|
if (inp.hasAttribute('disabled')) {
|
|||
|
|
inp.setAttribute('readonly', 'true');
|
|||
|
|
inp.removeAttribute('disabled');
|
|||
|
|
inp.value = "This text field is readonly!";
|
|||
|
|
} else {
|
|||
|
|
inp.setAttribute('disabled', 'disabled');
|
|||
|
|
inp.removeAttribute('readonly');
|
|||
|
|
inp.value = "This text field is disabled!";
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
if (!ace.vars['touch']) {
|
|||
|
|
$('.chosen-select').chosen({
|
|||
|
|
allow_single_deselect: true
|
|||
|
|
});
|
|||
|
|
$(window)
|
|||
|
|
.off('resize.chosen')
|
|||
|
|
.on('resize.chosen', function() {
|
|||
|
|
$('.chosen-select').each(function() {
|
|||
|
|
var $this = $(this);
|
|||
|
|
$this.next().css({
|
|||
|
|
'width': $this.parent().width()
|
|||
|
|
});
|
|||
|
|
})
|
|||
|
|
}).trigger('resize.chosen');
|
|||
|
|
//resize chosen on sidebar collapse/expand
|
|||
|
|
$(document).on('settings.ace.chosen', function(e, event_name, event_val) {
|
|||
|
|
if (event_name != 'sidebar_collapsed') return;
|
|||
|
|
$('.chosen-select').each(function() {
|
|||
|
|
var $this = $(this);
|
|||
|
|
$this.next().css({
|
|||
|
|
'width': $this.parent().width()
|
|||
|
|
});
|
|||
|
|
})
|
|||
|
|
});
|
|||
|
|
$('#chosen-multiple-style .btn').on('click', function(e) {
|
|||
|
|
var target = $(this).find('input[type=radio]');
|
|||
|
|
var which = parseInt(target.val());
|
|||
|
|
if (which == 2) $('#form-field-select-4').addClass('tag-input-style');
|
|||
|
|
else $('#form-field-select-4').removeClass('tag-input-style');
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
$('[data-rel=tooltip]').tooltip({
|
|||
|
|
container: 'body'
|
|||
|
|
});
|
|||
|
|
$('[data-rel=popover]').popover({
|
|||
|
|
container: 'body'
|
|||
|
|
});
|
|||
|
|
autosize($('textarea[class*=autosize]'));
|
|||
|
|
$('textarea.limited').inputlimiter({
|
|||
|
|
remText: '%n character%s remaining...',
|
|||
|
|
limitText: 'max allowed : %n.'
|
|||
|
|
});
|
|||
|
|
//"jQuery UI Slider"
|
|||
|
|
//range slider tooltip example
|
|||
|
|
$("#slider-range").css('height', '200px').slider({
|
|||
|
|
orientation: "vertical",
|
|||
|
|
range: true,
|
|||
|
|
min: 0,
|
|||
|
|
max: 100,
|
|||
|
|
values: [17, 67],
|
|||
|
|
slide: function(event, ui) {
|
|||
|
|
var val = ui.values[$(ui.handle).index() - 1] + "";
|
|||
|
|
if (!ui.handle.firstChild) {
|
|||
|
|
$("<div class='tooltip right in' style='display:none;left:16px;top:-6px;'><div class='tooltip-arrow'></div><div class='tooltip-inner'></div></div>")
|
|||
|
|
.prependTo(ui.handle);
|
|||
|
|
}
|
|||
|
|
$(ui.handle.firstChild).show().children().eq(1).text(val);
|
|||
|
|
}
|
|||
|
|
}).find('span.ui-slider-handle').on('blur', function() {
|
|||
|
|
$(this.firstChild).hide();
|
|||
|
|
});
|
|||
|
|
$("#slider-range-max").slider({
|
|||
|
|
range: "max",
|
|||
|
|
min: 1,
|
|||
|
|
max: 10,
|
|||
|
|
value: 2
|
|||
|
|
});
|
|||
|
|
$("#slider-eq > span").css({
|
|||
|
|
width: '90%',
|
|||
|
|
'float': 'left',
|
|||
|
|
margin: '15px'
|
|||
|
|
}).each(function() {
|
|||
|
|
// read initial values from markup and remove that
|
|||
|
|
var value = parseInt($(this).text(), 10);
|
|||
|
|
$(this).empty().slider({
|
|||
|
|
value: value,
|
|||
|
|
range: "min",
|
|||
|
|
animate: true
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
$("#slider-eq > span.ui-slider-purple").slider('disable'); //disable third item
|
|||
|
|
$('#id-input-file-1 , #id-input-file-2').ace_file_input({
|
|||
|
|
no_file: 'No File ...',
|
|||
|
|
btn_choose: 'Choose',
|
|||
|
|
btn_change: 'Change',
|
|||
|
|
droppable: false,
|
|||
|
|
onchange: null,
|
|||
|
|
thumbnail: false //| true | large
|
|||
|
|
//whitelist:'gif|png|jpg|jpeg'
|
|||
|
|
//blacklist:'exe|php'
|
|||
|
|
//onchange:''
|
|||
|
|
//
|
|||
|
|
});
|
|||
|
|
//pre-show a file name, for example a previously selected file
|
|||
|
|
//$('#id-input-file-1').ace_file_input('show_file_list', ['myfile.txt'])
|
|||
|
|
//datepicker plugin
|
|||
|
|
//link
|
|||
|
|
var today = new Date();
|
|||
|
|
$('#issue_date').val(today.getDate() + "/" + (parseInt(today.getMonth()) + 1) + "/" + today.getFullYear())
|
|||
|
|
$('#issue_date').datepicker({
|
|||
|
|
autoclose: true,
|
|||
|
|
format: 'dd/mm/yyyy',
|
|||
|
|
startDate: '1d/1m/2000y',
|
|||
|
|
endDate: 'current',
|
|||
|
|
todayHighlight: true,
|
|||
|
|
defaultDate: new Date(),
|
|||
|
|
}).next().on(ace.click_event, function() {
|
|||
|
|
$(this).prev().focus();
|
|||
|
|
});
|
|||
|
|
$('.date-picker').datepicker({
|
|||
|
|
autoclose: true,
|
|||
|
|
todayHighlight: true
|
|||
|
|
})
|
|||
|
|
//show datepicker when clicking on the icon
|
|||
|
|
.next().on(ace.click_event, function() {
|
|||
|
|
$(this).prev().focus();
|
|||
|
|
});
|
|||
|
|
//chosen plugin inside a modal will have a zero width because the select element is originally hidden
|
|||
|
|
//and its width cannot be determined.
|
|||
|
|
//so we set the width after modal is show
|
|||
|
|
$('#modal-form').on('shown.bs.modal', function() {
|
|||
|
|
if (!ace.vars['touch']) {
|
|||
|
|
$(this).find('.chosen-container').each(function() {
|
|||
|
|
$(this).find('a:first-child').css('width', '210px');
|
|||
|
|
$(this).find('.chosen-drop').css('width', '210px');
|
|||
|
|
$(this).find('.chosen-search input').css('width', '200px');
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
/**
|
|||
|
|
//or you can activate the chosen plugin after modal is shown
|
|||
|
|
//this way select element becomes visible with dimensions and chosen works as expected
|
|||
|
|
$('#modal-form').on('shown', function () {
|
|||
|
|
$(this).find('.modal-chosen').chosen();
|
|||
|
|
})
|
|||
|
|
*/
|
|||
|
|
$(document).one('ajaxloadstart.page', function(e) {
|
|||
|
|
autosize.destroy('textarea[class*=autosize]')
|
|||
|
|
$('.limiterBox,.autosizejs').remove();
|
|||
|
|
$('.daterangepicker.dropdown-menu,.colorpicker.dropdown-menu,.bootstrap-datetimepicker-widget.dropdown-menu')
|
|||
|
|
.remove();
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
<?php if ($_REQUEST['pa_id'] != null && $_REQUEST['pa_id'] != '') { ?>
|
|||
|
|
$('#beneficiary').val('<?= $_REQUEST['pa_id'] ?>');
|
|||
|
|
$('.select2').select2();
|
|||
|
|
<?php } ?>
|
|||
|
|
|
|||
|
|
function filterItems() {
|
|||
|
|
|
|||
|
|
var agency = $('#distribution_vendor').val();
|
|||
|
|
var act = $('#activity_name').val();
|
|||
|
|
$.ajax({
|
|||
|
|
url: 'select_agency_item.php',
|
|||
|
|
type: "POST",
|
|||
|
|
data: {
|
|||
|
|
agency: agency,
|
|||
|
|
act: act
|
|||
|
|
},
|
|||
|
|
dataType: 'JSON',
|
|||
|
|
success: function(data) {
|
|||
|
|
// alert(data.length)
|
|||
|
|
if (data.length > 0) {
|
|||
|
|
var opt = '<option value="">Please Seletct Item</option>';
|
|||
|
|
for (var i = 0; i < data.length; i++) {
|
|||
|
|
opt += "<option value='" + data[i].item_id + "'>" + data[i].item_name + "</option>";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$(".item_option").each(function() {
|
|||
|
|
if ($(this).val() == null || $(this).val() == '') {
|
|||
|
|
$(this).html(opt);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
},
|
|||
|
|
error: function(data) {
|
|||
|
|
BootstrapDialog.alert('Error pulling Item Details');
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function getQty(item_id, count) {
|
|||
|
|
|
|||
|
|
if (item_id != '' && item_id != null) {
|
|||
|
|
$("#check_item").val(item_id);
|
|||
|
|
$.ajax({
|
|||
|
|
url: 'select_item_session_limit.php',
|
|||
|
|
type: "POST",
|
|||
|
|
data: $("#direct_item_issue").serialize(),
|
|||
|
|
dataType: 'JSON',
|
|||
|
|
success: function(data) {
|
|||
|
|
// alert(data.qty);
|
|||
|
|
if (data.qty != null && data.qty != '') {
|
|||
|
|
$('#issue_qty' + count).val(parseInt(data.qty));
|
|||
|
|
|
|||
|
|
chk_issue_qty(data.qty, count);
|
|||
|
|
check_season_limit(data.qty, count);
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
error: function(data) {
|
|||
|
|
BootstrapDialog.alert('Error pulling Item Details');
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
calculateGrandTotal();
|
|||
|
|
getParamters();
|
|||
|
|
|
|||
|
|
function removeOldData() {
|
|||
|
|
|
|||
|
|
var content = `<tr>
|
|||
|
|
<td style="width:20%">
|
|||
|
|
|
|||
|
|
<select class="form-control select2 item_option" id="item_id0" name="item_id0" onchange="setItemCurrentStock(this.value,'0'); setItemBatchNo(this.value,'0');getUnitForChildItem('child_item_unit',this.value,0)" data-placeholder="Choose a item..." style="width: 100%;">
|
|||
|
|
<option value=""></option>` +
|
|||
|
|
"<?php echo generate_options("SELECT item_id, item_name FROM tbl_items i left join medicine_form f on i.item_form_id=f.form_id where status='1' and ohc_type_id='" . $_SESSION['current_ohcttype'] . "' and RoleCode = '" . $_SESSION['role_type'] . "' ", $row_stock_issue['item_id'], 'item_id', 'item_name', '', ''); ?>"
|
|||
|
|
|
|||
|
|
+
|
|||
|
|
`</select>
|
|||
|
|
</td>
|
|||
|
|
<td style="width:20%">
|
|||
|
|
<select name="item_batch_no0" id="item_batch_no0" onchange="chk_duplicate_batch(this.value,0)" class="form-control">
|
|||
|
|
</select>
|
|||
|
|
</td>
|
|||
|
|
|
|||
|
|
<td style="width:10%">
|
|||
|
|
<input disabled type="number" name="current_stock0" id="current_stock0" class="form-control" />
|
|||
|
|
</td>
|
|||
|
|
<td style="width:10%">
|
|||
|
|
<input style="display: none;" type="number" name="issue_qty0" id="issue_qty0" onchange="check_season_limit(this.value,0)" oninput="chk_issue_qty(this.value,0)" class="form-control" />
|
|||
|
|
<span onclick="get_group_id($('#item_id0').val())" id="group_id0" style="border:none; background:none; cursor:pointer;display: none;"><i class="ace-icon fa fa-archive" style="font-size: 20px;"></i>
|
|||
|
|
</span>
|
|||
|
|
</td>
|
|||
|
|
<td style="width:10%">
|
|||
|
|
<input readonly type="number" name="per_unit_rate0" id="per_unit_rate0" oninput="calculateTotalRate(this.value,0)" class="form-control" />
|
|||
|
|
</td>
|
|||
|
|
<td style="width:10%">
|
|||
|
|
<input readonly type="number" name="total_rate0" id="total_rate0" class="form-control" />
|
|||
|
|
</td>
|
|||
|
|
|
|||
|
|
<td style="width:10%">
|
|||
|
|
<input readonly type="hidden" name="subsidy0" id="subsidy0" value="" class="form-control" />
|
|||
|
|
<input readonly type="number" name="subsidy_percent0" id="subsidy_percent0" oninput="calculateTotalRate(this.value,0)" class="form-control" />
|
|||
|
|
</td>
|
|||
|
|
|
|||
|
|
<td style="width:10%">
|
|||
|
|
<input readonly type="number" name="payable_price0" id="payable_price0" class="form-control" />
|
|||
|
|
</td>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
<td style="width:10%">
|
|||
|
|
<input type="text" name="transaction_remarks0" id="transaction_remarks0" class="form-control" />
|
|||
|
|
</td>
|
|||
|
|
<td style="width:8%">
|
|||
|
|
<div id="child_item_unit0"></div>
|
|||
|
|
</td>
|
|||
|
|
|
|||
|
|
<td style="width:10%">
|
|||
|
|
</td></tr>`;
|
|||
|
|
$('#count_items').val(1);
|
|||
|
|
$('#myBody').html(content);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function setAgency() {
|
|||
|
|
var act = $('#activity_name').val();
|
|||
|
|
if (act != '' && act != null) {
|
|||
|
|
|
|||
|
|
$.ajax({
|
|||
|
|
url: 'select_agency_of_activity.php',
|
|||
|
|
type: "POST",
|
|||
|
|
data: {
|
|||
|
|
act: act
|
|||
|
|
},
|
|||
|
|
dataType: 'JSON',
|
|||
|
|
success: function(data) {
|
|||
|
|
// alert(data.qty);
|
|||
|
|
var content = "<option value='' selected Disabled>Please Select Agency</option>";
|
|||
|
|
if (data != null && data != "") {
|
|||
|
|
Object.keys(data).forEach(function(key) {
|
|||
|
|
|
|||
|
|
console.log(key, data[key]);
|
|||
|
|
content += "<option value='" + key + "'>" + data[key] + "</option>";
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
|
|||
|
|
} else {
|
|||
|
|
content += "<?php echo generateOption('agency', 'agency_name', 'id', $distribution_vendor, '') ?>";
|
|||
|
|
}
|
|||
|
|
$("#distribution_vendor").html(content);
|
|||
|
|
$("#distribution_vendor").trigger("chosen:updated");
|
|||
|
|
|
|||
|
|
|
|||
|
|
},
|
|||
|
|
error: function(data) {
|
|||
|
|
BootstrapDialog.alert('Error pulling Item Details');
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
</script>
|