Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <input type="text" id="search" placeholder="Поиск КОД МКТ">
- <table>
- <thead>
- <th>№ п/п</th><th>Наименование медицинской услуги</th><th>КОД МКТ</th><th>Стоимость,руб</th><th>Количество</th><th>Добавить</th>
- </thead>
- <tbody id='manage1'>
- <script type="text/javascript">
- $("#search").on("keyup", function () {
- var value = $(this).val().toLowerCase();
- if (value.length >= 3) {
- $.getJSON("/hospitalPrice/ajaxGetPrice/?codeMkt=" + value, function (codeMkt) {
- var html = "";
- for (var i = 0; i < codeMkt.length; i++) {
- html = html +
- "<tr><td><input type='text' name='hospitalPrice[" + i + "].id' value='" + codeMkt[i].id + "' id='hospitalPrice[" + i + "].count' size='5' readonly></td>" +
- "<td><input type='text' name='hospitalPrice[" + i + "].name' value='" + codeMkt[i].name + "' id='hospitalPrice[" + i + "].name' size='50' readonly></td>" +
- "<td><input type='text' name='hospitalPrice[" + i + "].codeMkt' value='" + codeMkt[i].codeMkt + "' id='hospitalPrice[" + i + "].codeMkt' size='8' readonly></td>" +
- "<td><input type='text' name='hospitalPrice[" + i + "].price' value='" + codeMkt[i].price + "' id='hospitalPrice[" + i + "].price' size='6' readonly></td>" +
- "<td><input type='number' name='hospitalPrice[" + i + "].count' value='1' id='hospitalPrice[" + i + "].count' size='2' ></td>" +
- "<td><button type='button' class='move'>+</button></td></tr>";
- }
- $("#manage1").empty().append(html);
- });
- }
- });
- </script>
- %{--<tr><td>999</td><td>test</td><td>2007</td><td>900</td></tr>--}%
- </tbody>
- </table>
- <h3>Выбранные Мед услуги</h3>
- <table>
- <thead>
- <th>№ п/п</th><th>Наименование медицинской услуги</th><th>КОД МКТ</th><th>Стоимость,руб</th><th>Количество</th><th>Удалить</th>
- </thead>
- <tbody id='manage2'>
- </tbody>
- </table>
- <script type="text/javascript">
- var productInfo = ${selectedProduct.productParametersJSON};
- $('#manage1').on('click', 'button', function () {
- var $row = $(this).closest("tr");
- var surgeryAmount = parseInt(($("#surgeryAmount").val()) + parseInt(($row.find("input[id][name$='price']").val()) * parseInt(($row.find("input[id][name$='count']").val());
- var premiumAmount = "";
- var sumInsured = "";
- if (surgeryAmount) {
- var insurancePeriod = $("#insurancePeriod").val();
- premiumAmount = (surgeryAmount / (1 - productInfo.premiumAmountRate / 100)).toFixed(1);
- sumInsured = (premiumAmount / (productInfo.sumInsuredRate / 100)).toFixed(2);
- }
- $("#surgeryAmount").val(surgeryAmount);
- $("#calculatedSumInsured").val(sumInsured);
- $("#calculatedPremiumAmount").val(premiumAmount);
- $row.find("input[id][name$='count']").prop('readonly', true);
- $('#manage2').append($row);
- });
- $('#manage2').on('click', 'button', function () {
- var $row = $(this).closest("tr");
- var surgeryAmount = parseInt(($("#surgeryAmount").val()) - parseInt(($row.find("input[id][name$='price']").val()) * parseInt(($row.find("input[id][name$='count']").val());
- var premiumAmount = "";
- var sumInsured = "";
- if (surgeryAmount) {
- var insurancePeriod = $("#insurancePeriod").val();
- premiumAmount = (surgeryAmount / (1 - productInfo.premiumAmountRate / 100)).toFixed(1);
- sumInsured = (premiumAmount / (productInfo.sumInsuredRate / 100)).toFixed(2);
- }
- $("#surgeryAmount").val(surgeryAmount);
- $("#calculatedSumInsured").val(sumInsured);
- $("#calculatedPremiumAmount").val(premiumAmount);
- $row.find("input[id][name$='count']").prop('readonly', false);
- $('#manage1').append($row);
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement