}
}
+ $update = false;
+ if (!empty($start_time) && !empty($end_time)) {
+ $start_time_unix = strtotime($start_time);
+ $startMonth = date("Y-m-01");
+ $end_time_unix = strtotime($end_time);
+ if (
+ $startMonth <= (date("Y-m-d", strtotime($start_time)))
+ ||
+ ($end_time_unix < (time() - 90 * 86400))
+ ) {
+ $update = true;
+ }
+ }
+ $update = true;
if (!empty($result['write_offs'])) {
+ if (!empty($start_time) and !empty($end_time)) {
+ if ($update) {
+ WriteOffs::deleteAll(['and', ['>=', 'date', $start_time], ['<=', 'date', $end_time]]);
+ }
+ }
+
foreach ($result["write_offs"] as $gi => $arr) {
if (!empty($arr["error"])) {
file_put_contents(self::OUT_DIR . '/created_write_offs_erp_error.txt', PHP_EOL . " " . $arr["id"] . " error=" . $arr["error"], FILE_APPEND);
}
}
- $update = false;
- if (!empty($start_time) && !empty($end_time)) {
- $start_time_unix = strtotime($start_time);
- $startMonth = date("Y-m-01");
- $end_time_unix = strtotime($end_time);
- if (
- $startMonth <= (date("Y-m-d", strtotime($start_time)))
- ||
- ($end_time_unix < (time() - 90 * 86400))
- ) {
- $update = true;
- }
- }
-
if (!empty($checks_dell) and !empty($start_time) and !empty($end_time)) {
if ($update) {
Sales::updateAll(['operation' => 'Удален'], ['and', ['>=', 'date', $start_time], ['<=', 'date', $end_time]]);