superedit-WINDYKACJA_ZESTAWIENIE_NADPLATY_VECTRA.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. require_once APP_PATH_ROOT . DS . 'superedit-USERS2_WINDYKACJA_STATUS.php';
  3. function WINDYKACJA_ZESTAWIENIE_NADPLATY_VECTRA() {
  4. $db = DB::getDB();
  5. if (!$db) {
  6. echo '<div class="alert alert-danger">' . "Database Error" . '</div>';
  7. return;
  8. }
  9. $task = V::get('task', '', $_REQUEST);
  10. if ('zest_month' == $task) {
  11. $args = array();
  12. $args['zest_month'] = V::get('zest_month', '', $_REQUEST);
  13. $zest_month_arr = explode('-', $args['zest_month']);
  14. if (count($zest_month_arr) != 2) {
  15. die('Error: date format');
  16. }
  17. $args['year'] = intval(array_shift($zest_month_arr));
  18. $args['month'] = intval(array_shift($zest_month_arr));
  19. if (intval($args['year']) < 2014) {
  20. die('Error: year');
  21. }
  22. if (intval($args['month']) < 1 || intval($args['month']) > 12) {
  23. die('Error: month');
  24. }
  25. $args['DATE_LIMIT'] = sprintf("%4d-%02d-01", $args['year'], $args['month']);
  26. $_GET['DATE_LIMIT'] = $args['DATE_LIMIT'];
  27. WindykacjaView::zestawienie_vectra_nadplaty();
  28. die();
  29. }
  30. ?>
  31. <div class="jumbotron">
  32. <div class="container">
  33. <form class="form-inline" method="POST">
  34. <input type="hidden" name="HEADER_NOT_INIT" value="YES" />
  35. <input type="hidden" name="task" value="zest_month" />
  36. <label for="zest_month">Zestawienie nadpłat klientów Vectra na miesiąc:</label>
  37. <div class="input-group date" id="fldZestMonth">
  38. <input type="text" name="zest_month" class="form-control" value="" />
  39. <span class="input-group-addon"><span class="glyphicon glyphicon-time"></span></span>
  40. </div>
  41. <button type="submit" id="fldZestMonthBtn" class="btn btn-primary" autocomplete="off">
  42. Generuj zestawienie
  43. </button>
  44. </form>
  45. </div>
  46. </div>
  47. <script type="text/javascript">
  48. jQuery(document).ready(function () {
  49. jQuery('#fldZestMonthBtn').on('click', function () {
  50. jQuery(this).text(jQuery(this).text() + '...').attr('disabled', 'disabled');
  51. jQuery(this).parent().submit();
  52. })
  53. jQuery("#fldZestMonth").datetimepicker({
  54. format: "YYYY-MM",
  55. defaultDate: new Date(<?php echo date("Y"); ?>, <?php echo intval(date("m")) - 1; ?>, 1),
  56. minDate: new Date(2014, 11, 1),
  57. // maxDate: "<?php echo date("Y"); ?>"
  58. });
  59. });
  60. </script>
  61. <?php
  62. }