PHP - Moved: Timepicker Onclose: Not Trigering A Calculate Function.
This topic has been moved to Ajax Help.
http://www.phpfreaks.com/forums/index.php?topic=346111.0 Similar TutorialsThis topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=349813.0 I have an array whose each element is like 3632873_1_right or 3632873_1_left where 3632873 is the member ID , 1 is the level in the binary tree and left/right is the position in the tree i.e right child or left child. I would like to calculate pair in each level . 1 right and 1 left in a level is considered as a pair. So suppose in level 1 there are 2 ids (in the array shown below) 3632873 and 5951538.3632873 is right child and 5951538 is left child. Thus level 1 has one pair. However in level 2 there are 2 elements 8930480 and 7563232, but both of them are left child. Thus there are no pairs in level 2. Finally i need the total number of pairs adding pairs of each level.I am trying to make a function for it, however i'm not getting how to. Can someone please point me how can i do so ? Code: [Select] Array ( [0] => 3632873_1_right [1] => 5951538_1_left [2] => 8930480_2_left [3] => 7563232_2_left ) This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=330840.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=329003.0 Hello,
I am not very good at javascript.
Actually i have form like this
<td> <input type="text" name="item[]" id="category" value="<?php echo $row1['item'];?>" /></td> <td> <input type="text" name="uom[]" class="span2" value="<?php echo $row1['uom'];?>" /></td> <td> <input type="text" name="description[]" value="<?php echo $row1['description'];?>" /></td> <td><input type="text" class="jQinv_item_qty span1" name="quantity[]" /></td> <td><input type="text" class="jQinv_item_unit span1" name="price[]" value="<?php echo $row1['selling_price'];?>" /></td> <td><select name="tax[]" class="jQinv_item_tax span1"> <option value="<?php echo $row1['tax'];?>"><?php echo $row1['tax'];?></option> <?php $l1 = mysql_query("select * from taxes") or die (mysql_error()); while($l2 = mysql_fetch_array($l1)) { ?> <option value="<?php echo $l2['rate']; ?>"> <?php echo $l2['name'];?> - <?php echo $l2['rate'];?>% </option> <?php } ?> </select></td> <td> <input type="text" class="jQinv_item_discount span1" name="discount[]" value="<?php echo $row1['discount'];?>" /></td> <td><input type="text" class="jQinv_item_frt span1" name="freight[]" placeholder="Freight" /></td> <td><input type="text" class="jQinv_item_frtax span1" name="freight_tax[]" placeholder="Frt Tax" /></td> <td><input type="text" class="jQinv_item_total span2" name="total[]" /></td> a =( ((Quantity * Price) - Discount) * (tax/100) ) + Freight + (Freight * (Freight tax/100))I tried doing like this, But it did not work at all function rowInputs() { var balance = 0; var subTotal = 0; var taxTotal = 0; $(".invE_table tr").not('.last_row').each(function () { var $unit_price = $('.jQinv_item_unit', this).val(); var $qty = $('.jQinv_item_qty', this).val(); var $tax = $('.jQinv_item_tax', this).val(); var $discount = $('.jQinv_item_discount', this).val(); var $frt = $('.jQinv_item_frt', this).val(); var $frtax = $('.jQinv_item_frtax', this).val(); var $total = (($unit_price * 1) * ($qty * 1))- $discount; var $tax_amount = (($total) *($tax/parseFloat("100"))); var $total_amount = (($tax_amount) + ($frt)) + $frtax; var parsedTotal = parseFloat( ('0' + $total_amount).replace(/[^0-9-\.]/g, ''), 10 ); var parsedTax = parseFloat( ('0' + $tax_amount).replace(/[^0-9-\.]/g, ''), 10 ); var parsedSubTotal = parseFloat( ('0' + $total).replace(/[^0-9-\.]/g, ''), 10 ); $('.jQinv_item_total',this).val(parsedTotal.toFixed(2)); subTotal += parsedSubTotal; taxTotal += parsedTax; balance += parsedTotal; }); var discount = parseFloat( ('0' + $('#inv_discount').val()).replace(/[^0-9-\.]/g, ''), 10 ); var balance_disc = balance - discount; $(".invE_subtotal span").html(subTotal.toFixed(2)); $(".invE_tax span").html(taxTotal.toFixed(2)); $(".invE_discount span").html(discount.toFixed(2)); $(".invE_balance span").html(balance_disc.toFixed(2)); } I have trouble calling timepicker with class and passing data-values to the script.
So what i have so far is one loop that for each entry it will create foreach($data as $value){ $min_hour = $value['minhour']; // returns value from DB like 7 to 12 echo '<td><input type="text" value="" class="schedule-timepicker" data-minhour="'.$min_hour.'" data-minminutes="30" data-maxhour="17" data-maxminutes="00"></td>'; }Then in js file I have $(document).ready(function(){ $('.schedule-timepicker').timepicker({ timeFormat: 'HH:mm:ss', minDate: new Date(1, 1, 1, $('.schedule-timepicker').data('minhour'), 00), maxDate: new Date(1, 1, 1, $('.schedule-timepicker').data('maxhour'), 00), }); });Problem is that the timepicker is called out and works but every input has the same minimum hours value as the first one. Please help how to resolve this. Thanks. Hi, I have two timepickers start time and end time.When I select start time,the end time should have all the times disabled before start time.I am having Add button.When add button is clicked,again two timepickers are added.In these two,I can't able to set mintime of end timepicker from start time.Here is the code <div id='adddiv'> <input type="hidden" name="count" id="count"> <p>From:<input type="text" style="width: 70px;" id="timepicker1" name="visiting_time_start"/> To:<input type="text" style="width: 70px;" id="timepicker2" name="visiting_time_end"/> <a href='#' id='sadd'><img src="<?php echo base_url();?>template/images/plus_button.png" alt="Add"></a> </p></div> $(document).ready(function() { var addDiv = $('#adddiv'); var i = $('#adddiv p').size() + 1; var j=0;var k=i-1; $('#sadd').unbind("click").on('click', function() { var aid="timepickera"+k; var bid="timepickerb"+k; $('<p>From:<input type="text" id='+aid+' style="width: 70px;" name="visiting_time_start' + i +'" value="" />To:<input type="text" id='+bid+' style="width: 70px;" name="visiting_time_end' + i +'" value="" /><a href="#" id="srem"> <img src="<?php echo base_url();?>template/images/remove.jpg" height=16 width=16 alt="Remove"></a> </p>').appendTo(addDiv); $('#timepickera'+k).timepicker({ showLeadingZero: false, onSelect: function( time, endTimePickerInst ) { t1=time; $("#timepickerb"+k).timepicker('option', { minTime: { hour: endTimePickerInst.hours, minute: endTimePickerInst.minutes } }); }, minTime: { hour: 10, minute: 00 } }); $('#timepickerb'+k).timepicker({ showLeadingZero: false, }); i++;j++;k++; $('#count').val(j); return false; }); $(document).on('click', '#srem' , function(){ if( i > 2 ) { $(this).parents('p').remove(); i--;j--;k--; $('#count').val(j); } return false; }); $('#timepicker1').timepicker({ showLeadingZero: false, onSelect: tpStartSelect, minTime: { hour: 10, minute: 00 } }); $('#timepicker2').timepicker({ showLeadingZero: false, onSelect: tpEndSelect, }); }); // when start time change, update minimum for end timepicker function tpStartSelect( time, endTimePickerInst ) { $('#timepicker2').timepicker('option', { minTime: { hour: endTimePickerInst.hours, minute: endTimePickerInst.minutes } }); } // when end time change, update maximum for start timepicker function tpEndSelect( time, startTimePickerInst ) { $('#timepicker1').timepicker('option', { maxTime: { hour: startTimePickerInst.hours, minute: startTimePickerInst.minutes } }); }For timepicker1 and 2 its working fine.For dynamically created timepickers,I am not able to set mindate and max date.Can anyone help me... This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=346709.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=352833.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=346179.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=317682.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=316081.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=328704.0 This topic has been moved to PHP Installation & Configuration. http://www.phpfreaks.com/forums/index.php?topic=313336.0 This topic has been moved to CSS Help. http://www.phpfreaks.com/forums/index.php?topic=346775.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=308768.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=344481.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=316624.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=330989.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=346015.0 |