Parcourir la source

Windykacja zestawienia zadłużeń i nadpłat dla vectra (closes #83)

Piotr Labudda il y a 11 ans
Parent
commit
a22eb00241

+ 70 - 0
SE/superedit-WINDYKACJA_ZESTAWIENIE_NADPLATY_VECTRA.php

@@ -0,0 +1,70 @@
+<?php
+
+require_once APP_PATH_ROOT . DS . 'superedit-USERS2_WINDYKACJA_STATUS.php';
+
+function WINDYKACJA_ZESTAWIENIE_NADPLATY_VECTRA() {
+
+	$db = DB::getDB();
+	if (!$db) {
+		echo '<div class="alert alert-danger">' . "Database Error" . '</div>';
+		return;
+	}
+
+	$task = V::get('task', '', $_REQUEST);
+	if ('zest_month' == $task) {
+		$args = array();
+		$args['zest_month'] = V::get('zest_month', '', $_REQUEST);
+		$zest_month_arr = explode('-', $args['zest_month']);
+		if (count($zest_month_arr) != 2) {
+			die('Error: date format');
+		}
+		$args['year'] = intval(array_shift($zest_month_arr));
+		$args['month'] = intval(array_shift($zest_month_arr));
+		if (intval($args['year']) < 2014) {
+			die('Error: year');
+		}
+		if (intval($args['month']) < 1 || intval($args['month']) > 12) {
+			die('Error: month');
+		}
+		$args['DATE_LIMIT'] = sprintf("%4d-%02d-01", $args['year'], $args['month']);
+
+		$_GET['DATE_LIMIT'] = $args['DATE_LIMIT'];
+		WindykacjaView::zestawienie_vectra_nadplaty();
+		die();
+	}
+
+	?>
+<div class="jumbotron">
+  <div class="container">
+		<form class="form-inline" method="POST">
+			<input type="hidden" name="HEADER_NOT_INIT" value="YES" />
+			<input type="hidden" name="task" value="zest_month" />
+			<label for="zest_month">Zestawienie nadpłat klientów Vectra na miesiąc:</label>
+			<div class="input-group date" id="fldZestMonth">
+				<input type="text" name="zest_month" class="form-control" value="" />
+				<span class="input-group-addon"><span class="glyphicon glyphicon-time"></span></span>
+			</div>
+			<button type="submit" id="fldZestMonthBtn" class="btn btn-primary" autocomplete="off">
+				Generuj zestawienie
+			</button>
+		</form>
+	</div>
+</div>
+<script type="text/javascript">
+jQuery(document).ready(function () {
+  jQuery('#fldZestMonthBtn').on('click', function () {
+    jQuery(this).text(jQuery(this).text() + '...').attr('disabled', 'disabled');
+		jQuery(this).parent().submit();
+  })
+
+	jQuery("#fldZestMonth").datetimepicker({
+		format: "YYYY-MM",
+		defaultDate: new Date(<?php echo date("Y"); ?>, <?php echo intval(date("m")) - 1; ?>, 1),
+		minDate: new Date(2014, 11, 1),
+		// maxDate: "<?php echo date("Y"); ?>"
+	});
+});
+</script>
+	<?php
+
+}

+ 70 - 0
SE/superedit-WINDYKACJA_ZESTAWIENIE_ZADLUZENIA_VECTRA.php

@@ -0,0 +1,70 @@
+<?php
+
+require_once APP_PATH_ROOT . DS . 'superedit-USERS2_WINDYKACJA_STATUS.php';
+
+function WINDYKACJA_ZESTAWIENIE_ZADLUZENIA_VECTRA() {
+
+	$db = DB::getDB();
+	if (!$db) {
+		echo '<div class="alert alert-danger">' . "Database Error" . '</div>';
+		return;
+	}
+
+	$task = V::get('task', '', $_REQUEST);
+	if ('zest_month' == $task) {
+		$args = array();
+		$args['zest_month'] = V::get('zest_month', '', $_REQUEST);
+		$zest_month_arr = explode('-', $args['zest_month']);
+		if (count($zest_month_arr) != 2) {
+			die('Error: date format');
+		}
+		$args['year'] = intval(array_shift($zest_month_arr));
+		$args['month'] = intval(array_shift($zest_month_arr));
+		if (intval($args['year']) < 2014) {
+			die('Error: year');
+		}
+		if (intval($args['month']) < 1 || intval($args['month']) > 12) {
+			die('Error: month');
+		}
+		$args['DATE_LIMIT'] = sprintf("%4d-%02d-01", $args['year'], $args['month']);
+
+		$_GET['DATE_LIMIT'] = $args['DATE_LIMIT'];
+		WindykacjaView::zestawienie_vectra_zadluzenia();
+		die();
+	}
+
+	?>
+<div class="jumbotron">
+  <div class="container">
+		<form class="form-inline" method="POST">
+			<input type="hidden" name="HEADER_NOT_INIT" value="YES" />
+			<input type="hidden" name="task" value="zest_month" />
+			<label for="zest_month">Zestawienie zadłużeń klientów Vectra na miesiąc:</label>
+			<div class="input-group date" id="fldZestMonth">
+				<input type="text" name="zest_month" class="form-control" value="" />
+				<span class="input-group-addon"><span class="glyphicon glyphicon-time"></span></span>
+			</div>
+			<button type="submit" id="fldZestMonthBtn" class="btn btn-primary" autocomplete="off">
+				Generuj zestawienie
+			</button>
+		</form>
+	</div>
+</div>
+<script type="text/javascript">
+jQuery(document).ready(function () {
+  jQuery('#fldZestMonthBtn').on('click', function () {
+    jQuery(this).text(jQuery(this).text() + '...').attr('disabled', 'disabled');
+		jQuery(this).parent().submit();
+  })
+
+	jQuery("#fldZestMonth").datetimepicker({
+		format: "YYYY-MM",
+		defaultDate: new Date(<?php echo date("Y"); ?>, <?php echo intval(date("m")) - 1; ?>, 1),
+		minDate: new Date(2014, 11, 1),
+		// maxDate: "<?php echo date("Y"); ?>"
+	});
+});
+</script>
+	<?php
+
+}