public static function getRepairList($carID = null, $getID = null, $limit = 0, $offset = 0) { if (is_null($carID)) { $carID = MyCar::getDefaultCarID(); } $arFilter = array(); if (!is_null($getID) && intval($getID) > 0) { $arFilter["ID"] = intval($getID); $limit = 1; } else { $arFilter['MY_CAR_ID'] = $carID; } $arList = array('select' => array('ID', 'MY_CAR_ID', 'MY_CAR_ID.NAME' => 'MY_CAR_NAME', 'MY_CAR_ID.CAR_NUMBER' => 'MY_CAR_NUMBER', 'DATE', 'COST', 'EXECUTOR_ID', 'EXECUTOR_ID.NAME' => "EXECUTOR_NAME", 'EXECUTOR_ID.CODE' => "EXECUTOR_CODE", 'NAME', 'ODO', 'REASON_REPLACEMENT_ID', 'REASON_REPLACEMENT_ID.NAME' => 'REASON_REPLACEMENT_NAME', 'REASON_REPLACEMENT_ID.CODE' => 'REASON_REPLACEMENT_CODE', 'TS_ID', 'TS_ID.TS_NUM' => 'TS_NUM', 'ACCIDENT_ID', 'ACCIDENT_ID.DESCRIPTION' => 'ACCIDENT_DESCRIPTION', 'WHO_PAID_ID', 'WHO_PAID_ID.NAME' => 'WHO_PAID_NAME', 'WHO_PAID_ID.CODE' => 'WHO_PAID_CODE', 'POINTS_ID', 'POINTS_ID.NAME' => 'POINT_NAME', 'POINTS_ID.LATITUDE' => 'POINT_LATITUDE', 'POINTS_ID.LONGITUDE' => 'POINT_LONGITUDE', 'POINTS_ID.POINT_TYPES_ID' => 'POINT_TYPE_ID', 'POINTS_ID.POINT_TYPES_ID.NAME' => 'POINT_TYPE_NAME', 'DESCRIPTION' => 'INFO'), 'filter' => $arFilter, 'order' => array('DATE' => 'ASC', 'ID' => 'ASC')); if ($limit > 0) { $arList['limit'] = $limit; } if ($offset > 0) { $arList['offset'] = $offset; } $arRes = RepairTable::getList($arList); return $arRes; }
public static function getAccidentList($carID = null, $getID = null, $limit = 0, $offset = 0) { if (is_null($carID)) { $carID = MyCar::getDefaultCarID(); } $arFilter = array(); if (!is_null($getID) && intval($getID) > 0) { $arFilter["ID"] = intval($getID); $limit = 1; } else { $arFilter['MY_CAR_ID'] = $carID; } $arList = array('select' => array('ID', 'MY_CAR_ID', 'MY_CAR_ID.NAME' => 'MY_CAR_NAME', 'MY_CAR_ID.CAR_NUMBER' => 'MY_CAR_NUMBER', 'ACCIDENT_DATE', 'ODO', 'YOU_INSURANCE_ID', 'YOU_INSURANCE_ID.NAME' => 'YOU_INSURANCE_NAME', 'SECOND_INSURANCE_ID', 'SECOND_INSURANCE_ID.NAME' => 'SECOND_INSURANCE_NAME', 'DAMAGE_PARTS', 'EXECUTOR_ID', 'EXECUTOR_ID.NAME' => "EXECUTOR_NAME", 'EXECUTOR_ID.CODE' => "EXECUTOR_CODE", 'WHO_PAID_ID', 'WHO_PAID_ID.NAME' => 'WHO_PAID_NAME', 'WHO_PAID_ID.CODE' => 'WHO_PAID_CODE', 'INSURANCE_PAID', 'POINTS_ID', 'POINTS_ID.NAME' => 'POINT_NAME', 'POINTS_ID.LATITUDE' => 'POINT_LATITUDE', 'POINTS_ID.LONGITUDE' => 'POINT_LONGITUDE', 'POINTS_ID.POINT_TYPES_ID' => 'POINT_TYPE_ID', 'POINTS_ID.POINT_TYPES_ID.NAME' => 'POINT_TYPE_NAME', 'DESCRIPTION' => 'INFO'), 'filter' => $arFilter, 'order' => array('ACCIDENT_DATE' => 'ASC', 'ID' => 'ASC')); if ($limit > 0) { $arList['limit'] = $limit; } if ($offset > 0) { $arList['offset'] = $offset; } $arRes = AccidentTable::getList($arList); return $arRes; }
$editID = intval($_REQUEST['id']); } else { die("ERROR"); } if (!isset($_POST["action"])) { if (!($arTs = Lib\Ts::getTsList(NULL, $editID))) { die("ERROR"); } //msDebug($arTs); ?> <form action="" method="post"> <table class="add_ts"> <tr> <td class="title">Автомобиль</td> <td><?php echo Lib\MyCar::showSelectCars("my_car", $arTs[0]["MY_CAR_ID"], 'class="myCar"'); ?> </td> </tr> <tr> <td class="title">Номер ТО</td> <td><?php echo Lib\Ts::showSelectTsNum("ts_num", $arTs[0]["TS_NUM"]); ?> </td> </tr> <tr> <td class="title">Дата</td> <td><?php echo InputCalendar('date', $arTs[0]["DATE"], 'class="calendarDate"', $strId = ""); ?>
} if (isset($_POST['action']) && intval($_POST['action']) == 1) { if (Lib\Fuel::addFuelFromPost($_POST)) { echo '<span class="ok">Данные успешно добавлены</span>'; } else { echo '<span class="err">Ошибка добавления данных</span>'; } } //msDebug(Lib\Odo::getMaxOdo($carID)); ?> <form action="" method="post"> <table class="add_ts"> <tr> <td class="title">Автомобиль</td> <td><?php echo Lib\MyCar::showSelectCars("my_car", $carID, 'class="myCar"'); ?> </td> </tr> <tr> <td class="title">Дата</td> <?php if (isset($_POST['date'])) { $date = $_POST['date']; } else { $date = date('d.m.Y'); } ?> <td><?php echo InputCalendar('date', $date, 'class="calendarDate"', $strId = ""); ?>
} ?> <p>Статистика для: <?php echo Lib\MyCar::showSelectCars("my_car", $carID, 'class="myCar"'); ?> <br> Общие затраты на топливо: <?php echo Lib\Fuel::getTotalFuelCostsFormatted($carID); ?> руб.<br> Средний расход топлива: <?php echo Lib\MyCar::getCarAverageFuelFormatted($carID); ?> л./100км.<br> Всего израсходованно топлива: <?php echo Lib\MyCar::getCarTotalSpentFuelFormatted($carID); ?> л.<br><br></p> <p><a href="add.php?car=<?php echo $carID; ?> ">Добавить запись</a><br><br></p> <?php Lib\Fuel::showListTable($carID); ?> <p><a href="add.php?car=<?php echo $carID; ?> ">Добавить запись</a><br><br></p>
<td colspan="5"><?php echo MyCar::getCarAverageFuelFormatted($myCar['ID']); ?> л./100км.</td> </tr> <tr> <td><b>Израсходованно топлива:</b></td> <td colspan="5"><?php echo MyCar::getCarTotalSpentFuelFormatted($myCar['ID']); ?> л.</td> </tr> <tr> <td><b>Текущий пробег:</b></td> <td colspan="5"><?php echo MyCar::getCarCurrentMileageFormatted($myCar['ID']); ?> км.</td> </tr> <tr> <td colspan="6"> </td> </tr> <tr> <td><b>Дополнительное описание:</b></td> <td colspan="5">В разработке</td> </tr> <tr> <td><b>Фотографии автомобиля:</b></td> <td colspan="5">В разработке</td> </tr> <tr>
protected static function getRepairPartsList($carID = null, $getID = null, $limit = 0, $offset = 0) { if (is_null($carID)) { $carID = MyCar::getDefaultCarID(); } $arFilter = array(); if (!is_null($getID) && intval($getID) > 0) { $arFilter["ID"] = intval($getID); $limit = 1; } else { $arFilter['MY_CAR_ID'] = $carID; } $arList = array('select' => array('ID', 'MY_CAR_ID', 'DATE', 'NAME', 'STORAGE_ID', 'CATALOG_NUMBER', 'NUMBER', 'COST', 'REASON_REPLACEMENT_ID', 'TS_ID', 'ACCIDENT_ID', 'REPAIR_ID', 'WHO_PAID_ID', 'ODO', 'POINTS_ID', 'DESCRIPTION' => 'INFO'), 'filter' => $arFilter, 'order' => array('DATE' => 'ASC', 'ID' => 'ASC')); if ($limit > 0) { $arList['limit'] = $limit; } if ($offset > 0) { $arList['offset'] = $offset; } $arRes = Tables\RepairPartsTable::getList($arList); if ($arRes) { foreach ($arRes as $key => &$ar_res) { if ($ar_res['MY_CAR_ID'] > 0) { $arRes2 = Tables\MyCarTable::getList(array('select' => array('NAME' => 'MY_CAR_NAME', 'CAR_NUMBER' => 'MY_CAR_NUMBER'), 'filter' => array('ID' => $ar_res['MY_CAR_ID']), 'limit' => 1)); if ($arRes2) { $arRes2 = $arRes2[0]; if (isset($arRes2['ID'])) { unset($arRes2['ID']); } $ar_res = array_merge($ar_res, $arRes2); } } if ($ar_res['STORAGE_ID'] > 0) { $arRes2 = Tables\StorageTable::getList(array('select' => array('NAME' => 'STORAGE_NAME', 'CODE' => 'STORAGE_CODE'), 'filter' => array('ID' => $ar_res['STORAGE_ID']), 'limit' => 1)); if ($arRes2) { $arRes2 = $arRes2[0]; if (isset($arRes2['ID'])) { unset($arRes2['ID']); } $ar_res = array_merge($ar_res, $arRes2); } } if ($ar_res['REASON_REPLACEMENT_ID'] > 0) { $arRes2 = Tables\ReasonReplacementTable::getList(array('select' => array('NAME' => 'REASON_REPLACEMENT_NAME', 'CODE' => 'REASON_REPLACEMENT_CODE'))); if ($arRes2) { $arRes2 = $arRes2[0]; if (isset($arRes2['ID'])) { unset($arRes2['ID']); } $ar_res = array_merge($ar_res, $arRes2); } } if ($ar_res['TS_ID'] > 0) { $arRes2 = Tables\TsTable::getList(array('select' => array('TS_NUM'), 'filter' => array('ID' => $ar_res['TS_ID']), 'limit' => 1)); if ($arRes2) { $arRes2 = $arRes2[0]; if (isset($arRes2['ID'])) { unset($arRes2['ID']); } $ar_res = array_merge($ar_res, $arRes2); } } if ($ar_res['ACCIDENT_ID'] > 0) { $arRes2 = Tables\AccidentTable::getList(array('select' => array('DESCRIPTION' => 'ACCIDENT_DESCRIPTION'), 'filter' => array('ID' => $ar_res['ACCIDENT_ID']), 'limit' => 1)); if ($arRes2) { $arRes2 = $arRes2[0]; if (isset($arRes2['ID'])) { unset($arRes2['ID']); } $ar_res = array_merge($ar_res, $arRes2); } } if ($ar_res['REPAIR_ID'] > 0) { $arRes2 = Tables\RepairTable::getList(array('select' => array('NAME' => 'REPAIR_NAME'), 'filter' => array('ID' => $ar_res['REPAIR_ID']), 'limit' => 1)); if ($arRes2) { $arRes2 = $arRes2[0]; if (isset($arRes2['ID'])) { unset($arRes2['ID']); } $ar_res = array_merge($ar_res, $arRes2); } } if ($ar_res['WHO_PAID_ID'] > 0) { $arRes2 = Tables\WhoPaidTable::getList(array('select' => array('NAME' => 'WHO_PAID_NAME', 'CODE' => 'WHO_PAID_CODE'))); if ($arRes2) { $arRes2 = $arRes2[0]; if (isset($arRes2['ID'])) { unset($arRes2['ID']); } $ar_res = array_merge($ar_res, $arRes2); } } if ($ar_res['POINTS_ID'] > 0) { $arRes2 = Tables\PointsTable::getList(array('select' => array('NAME' => 'POINT_NAME', 'LATITUDE' => 'POINT_LATITUDE', 'LONGITUDE' => 'POINT_LONGITUDE', 'POINT_TYPES_ID' => 'POINT_TYPE_ID', 'POINT_TYPES_ID.NAME' => 'POINT_TYPE_NAME'), 'filter' => array('ID' => $ar_res['POINTS_ID']), 'limit' => 1)); if ($arRes2) { $arRes2 = $arRes2[0]; if (isset($arRes2['ID'])) { unset($arRes2['ID']); } $ar_res = array_merge($ar_res, $arRes2); } } } unset($ar_res); } //msDebug($arRes); return $arRes; }
if ($('.check_confirm').is(':checked')) { $('.delete_submit').attr("disabled",false); } else { $('.delete_submit').attr("disabled",true); } }); }); </script> <?php } } } else { if (isset($_POST['confirm']) && (isset($_POST['car_id']) && intval($_POST['car_id']))) { $res = Lib\MyCar::deleteCar(intval($_POST['car_id'])); if ($res) { ?> <p>Автомобиль успешно удален</p><?php } else { ?> <p>При удалении возникла ошибка. Автомобиль не был удален</p><?php } } else { ?> <p>При удалении возникла ошибка. Автомобиль не был удален</p><?php } } $curDir = basename(__DIR__); include_once MSergeev\Core\Lib\Loader::getPublic("icar") . "include/footer.php";
if (isset($_POST['car_mileage'])) { $arParams['MILEAGE'] = floatval($_POST['car_mileage']); } if (isset($_POST['car_credit']) && $_POST['car_credit'] > 0) { $arParams['CREDIT'] = TRUE; } else { $arParams['CREDIT'] = FALSE; } if (isset($_POST['car_credit_cost'])) { $arParams['CREDIT_COST'] = floatval($_POST['car_credit_cost']); } if (isset($_POST['car_osago'])) { $arParams['DATE_OSAGO_END'] = htmlspecialchars($_POST['car_osago']); } if (isset($_POST['car_gto'])) { $arParams['DATE_GTO_END'] = htmlspecialchars($_POST['car_gto']); } if (isset($_POST['car_default']) && $_POST['car_default'] > 0) { $arParams['DEFAULT'] = TRUE; } else { $arParams['DEFAULT'] = FALSE; } } $res = Lib\MyCar::editCar($arParams); if ($res->getResult()) { ?> <div class="ok">Изменения успешно сохранены</div><?php } } $curDir = basename(__DIR__); include_once MSergeev\Core\Lib\Loader::getPublic("icar") . "include/footer.php";
/** * Функция высчитывает данные о пройденном расстоянии от выбранной даты или за все время * * @param int $carID * @param string $date */ protected static function updateDayOdometer($carID = null, $date = null) { $dateHelper = new DateHelper(); $arResult = array(); if (is_null($carID)) { $carID = MyCar::getDefaultCarID(); } if (is_null($date)) { //TODO: Проверить работу кода $arRes = Tables\RoutsTable::getList(array('select' => array('ID', 'DATE', 'ODO'), 'filter' => array('MY_CAR_ID' => $carID, '>ODO' => 0), 'order' => array('DATE' => 'ASC', 'ID' => 'ASC'))); $arResult['BUY_ODO'] = MyCar::getBuyCarOdo($carID); $arResult['MAX_DATE_ODO'] = array(); $bFirst = true; foreach ($arRes as $ar_res) { if ($bFirst) { $bFirst = false; $arResult['FIRST_DAY'] = $ar_res['DATE']; } $arResult['ROUTS'][$ar_res['ID']]['DATE'] = $ar_res['DATE']; $arResult['ROUTS'][$ar_res['ID']]['ODO'] = $ar_res['ODO']; if (!isset($arResult['MAX_DATE_ODO'][$ar_res['DATE']]) || $ar_res['ODO'] > $arResult['MAX_DATE_ODO'][$ar_res['DATE']]) { $arResult['MAX_DATE_ODO'][$ar_res['DATE']] = $ar_res['ODO']; } } $arResult['LAST_DAY'] = date('d.m.Y'); $lastOdo = $arResult['BUY_ODO']; $arResult['DAY_ODO'] = array(); foreach ($arResult['MAX_DATE_ODO'] as $day => $odo) { $arResult['DAY_ODO'][$day] = round($odo - $lastOdo, 1); $lastOdo = $odo; } $arResult['ODO_ALL_DAYS'] = array(); $now_day = $arResult['FIRST_DAY']; while ($now_day !== $arResult['LAST_DAY']) { if (isset($arResult['DAY_ODO'][$now_day])) { $arResult['ODO_ALL_DAYS'][$now_day] = $arResult['DAY_ODO'][$now_day]; } else { $arResult['ODO_ALL_DAYS'][$now_day] = 0; } $now_day = $dateHelper->strToTime($now_day, '+1 day', 'site'); } } else { $arResult['FIRST_DAY'] = $date; $arResult['LAST_DAY'] = date('d.m.Y'); $arResult['BUY_ODO'] = MyCar::getBuyCarOdo($carID); //TODO: Проверить работу кода $arRes = Tables\RoutsTable::getList(array('select' => array('ID', 'DATE', 'ODO'), 'filter' => array('MY_CAR_ID' => $carID, '>=DATE' => $date, '>ODO' => 0), 'order' => array('DATE' => 'ASC', 'ID' => 'ASC'))); $arResult['MAX_DATE_ODO'] = array(); foreach ($arRes as $ar_res) { $arResult['ROUTS'][$ar_res['ID']]['DATE'] = $ar_res['DATE']; $arResult['ROUTS'][$ar_res['ID']]['ODO'] = $ar_res['ODO']; if (!isset($arResult['MAX_DATE_ODO'][$ar_res['DATE']]) || $ar_res['ODO'] > $arResult['MAX_DATE_ODO'][$ar_res['DATE']]) { $arResult['MAX_DATE_ODO'][$ar_res['DATE']] = $ar_res['ODO']; } } //TODO: Проверить работу кода $arRes2 = Tables\RoutsTable::getList(array('select' => array('ID', 'DATE', 'ODO'), 'filter' => array('MY_CAR_ID' => $carID, '<DATE' => $date, '>ODO' => 0), 'order' => array('DATE' => 'DESC', 'ID' => 'DESC'))); if ($arRes2) { $lastOdo = $arRes2[0]['ODO']; $arResult['LAST_RES'] = $arRes2[0]; } else { $lastOdo = $arResult['BUY_ODO']; } $arResult['LAST_ODO'] = $lastOdo; $arResult['DAY_ODO'] = array(); foreach ($arResult['MAX_DATE_ODO'] as $day => $odo) { $arResult['DAY_ODO'][$day] = round($odo - $lastOdo, 1); $lastOdo = $odo; } $arResult['ODO_ALL_DAYS'] = array(); $now_day = $arResult['FIRST_DAY']; while ($now_day !== $arResult['LAST_DAY']) { if (isset($arResult['DAY_ODO'][$now_day])) { $arResult['ODO_ALL_DAYS'][$now_day] = $arResult['DAY_ODO'][$now_day]; } else { $arResult['ODO_ALL_DAYS'][$now_day] = 0; } $now_day = $dateHelper->strToTime($now_day, '+1 day', 'site'); } } //TODO: Проверить работу кода $arRes2 = Tables\OdoTable::getList(array('select' => array('ID', 'DATE', 'ODO'), 'filter' => array('MY_CAR_ID' => $carID, '>=DATE' => $arResult['FIRST_DAY']), 'order' => array('DATE' => 'ASC'))); $arResult['ODO_TABLE'] = array(); foreach ($arRes2 as $ar_res) { $arResult['ODO_TABLE'][$ar_res['DATE']] = array('ID' => $ar_res['ID'], 'ODO' => $ar_res['ODO']); } $arResult['UPDATED'] = $arResult['INSERTED'] = array(); foreach ($arResult['ODO_ALL_DAYS'] as $day => $odo) { if (isset($arResult['ODO_TABLE'][$day])) { if ($odo != $arResult['ODO_TABLE'][$day]['ODO']) { $query = new Query('update'); $query->setUpdateParams(array('ODO' => $odo), $arResult['ODO_TABLE'][$day]['ID'], Tables\OdoTable::getTableName(), Tables\OdoTable::getMapArray()); $res = $query->exec(); $arResult['UPDATED'][$day] = $res->getResult(); } } else { $query = new Query('insert'); $arInsert[0] = array('MY_CAR_ID' => $carID, 'DATE' => $day, 'ODO' => $odo); $query->setInsertParams($arInsert, Tables\OdoTable::getTableName(), Tables\OdoTable::getMapArray()); $res = $query->exec(); $arResult['INSERTED'][$day] = $res->getInsertId(); } } }
public static function addTsFromPost($post = null) { try { if (is_null($post)) { throw new Exception\ArgumentNullException('_POST'); } } catch (Exception\ArgumentNullException $e) { $e->showException(); return false; } $arAdd = array(); if (!isset($post['my_car']) || intval($post['my_car']) <= 0) { $arAdd['MY_CAR_ID'] = MyCar::getDefaultCarID(); } else { $arAdd['MY_CAR_ID'] = intval($post['my_car']); } if (!isset($post['ts_num'])) { return false; } else { $arAdd['TS_NUM'] = intval($post['ts_num']); } if (!isset($post['date']) || !CoreLib\DateHelper::checkDate($post['date'])) { return false; } else { if (!($arAdd['DATE'] = CoreLib\DateHelper::validateDate($post['date']))) { return false; } } if (!isset($post['executor']) || intval($post['executor']) <= 0) { return false; } else { $arAdd['EXECUTORS_ID'] = intval($post['executor']); } if (!isset($post['cost'])) { return false; } else { $post['cost'] = str_replace(" ", "", $post['cost']); $post['cost'] = str_replace(",", ".", $post['cost']); $post['cost'] = floatval($post['cost']); $arAdd['COST'] = $post['cost']; } if (!isset($post['odo'])) { return false; } else { $post['odo'] = str_replace(" ", "", $post['odo']); $post['odo'] = str_replace(",", ".", $post['odo']); $post['odo'] = floatval($post['odo']); $arAdd['ODO'] = $post['odo']; } if (isset($post['ts_point']) && intval($post['ts_point']) > 0) { $arAdd['POINTS_ID'] = intval($post['ts_point']); } else { if (isset($post['newpoint_address']) || isset($post['newpoint_lat']) && isset($post['newpoint_lon'])) { $arPoint = array(); if (isset($post['newpoint_name']) && strlen($post['newpoint_name']) > 3) { $arPoint['NAME'] = $post['newpoint_name']; } else { $arPoint['NAME'] = '[auto] Сервис'; } if (isset($post['newpoint_address']) && strlen($post['newpoint_address']) > 5) { $arPoint['ADDRESS'] = $post['newpoint_address']; } if (isset($post['newpoint_lat']) && strlen($post['newpoint_lat']) > 2 && (isset($post['newpoint_lon']) && strlen($post['newpoint_lon']) > 2)) { $arPoint['LON'] = $post['newpoint_lon']; $arPoint['LAT'] = $post['newpoint_lat']; } $arPoint['TYPE'] = Points::getPointTypeIdByCode('service'); $arAdd['POINTS_ID'] = Points::createNewPoint($arPoint); } else { return false; } } if (isset($post['comment']) && strlen($post['comment']) > 0) { $arAdd['DESCRIPTION'] = trim(htmlspecialchars($post['comment'])); } if ($addTsID = static::addTs($arAdd)) { CoreLib\Options::setOption('icar_last_ts_' . intval($arAdd['MY_CAR_ID']), $arAdd['TS_NUM']); CoreLib\Options::setOption('icar_last_executor_' . intval($arAdd['MY_CAR_ID']), $arAdd['EXECUTORS_ID']); CoreLib\Options::setOption('icar_last_executor_' . intval($arAdd['MY_CAR_ID']) . '_point', $arAdd['POINTS_ID']); return $addTsID; } else { return false; } }
</span><?php $bError = true; //msDebug($res); } } ?> <form action="" method="post"> <input type="hidden" name="car" value="<?php echo $carID; ?> "> <table class="add_ts"> <tr> <td class="title">Автомобиль</td> <td><?php echo Lib\MyCar::showSelectCars("my_car", $bError ? intval($_POST['my_car']) : $carID, 'class="myCar"'); ?> </td> </tr> <tr> <td class="title">Дата</td> <?php if (isset($_POST['date'])) { $date = $_POST['date']; } else { $date = date('d.m.Y'); } ?> <td><?php echo InputCalendar('date', $date, 'class="calendarDate"', $strId = ""); ?>
/** * Сохраняет последнюю использованную марку топлива для автомобиля * * @param int $fuelMark ID марки топлива * @param int $carID ID автомобиля * * @return bool */ protected static function setLastUseFuelMark($fuelMark = null, $carID = null) { try { if (is_null($fuelMark)) { throw new Exception\ArgumentNullException('fuelMark'); } } catch (Exception\ArgumentNullException $e) { $e->showException(); return false; } if (is_null($carID)) { $carID = MyCar::getDefaultCarID(); } if (!CoreLib\Options::setOption('icar_last_fuelmark_' . $carID, $fuelMark)) { return false; } else { return true; } }
$arParams['CREDIT'] = false; } if (isset($_POST['car_credit_cost'])) { $arParams['CREDIT_COST'] = floatval($_POST['car_credit_cost']); } if (isset($_POST['car_osago'])) { $arParams['DATE_OSAGO_END'] = htmlspecialchars($_POST['car_osago']); } if (isset($_POST['car_gto'])) { $arParams['DATE_GTO_END'] = htmlspecialchars($_POST['car_gto']); } if (isset($_POST['car_default']) && $_POST['car_default'] > 0) { $arParams['DEFAULT'] = true; } else { $arParams['DEFAULT'] = false; } } if (!isset($arParams['CAR_MODEL_ID']) && isset($arParams['CAR_MODEL_TEXT']) && $arParams['CAR_BRAND'] > 0) { $arParams['CAR_MODEL_ID'] = Lib\CarModel::addNewModel($arParams['CAR_BRAND'], $arParams['CAR_MODEL_TEXT']); if (intval($arParams['CAR_MODEL_ID']) > 0) { unset($arParams['CAR_MODEL_TEXT']); } } $res = Lib\MyCar::addNewCar($arParams); if ($res->getResult()) { ?> <div class="ok">Автомобиль успешно добавлен</div><?php } } $curDir = basename(__DIR__); include_once MSergeev\Core\Lib\Loader::getPublic("icar") . "include/footer.php";
<?php use MSergeev\Core\Lib; use MSergeev\Packages\Icar\Lib as CarLib; $path = Lib\Tools::getSitePath(Lib\Loader::getPublic("icar")); //Lib\Loc::setModuleMessages('icar'); $arAlerts = CarLib\MyCar::checkAlerts(); //msDebug($arAlerts); foreach ($arAlerts as $alert) { ?> <div class="alert_<?php echo $alert['COLOR']; ?> "><?php echo $alert['TEXT']; ?> </div> <?php } ?> <style> .alert_green { width: 95%; margin: 5px; padding: 10px; border: 1px solid darkgreen; background: lightgreen; color: darkgreen; text-align: justify; } .alert_yellow {
} } $arFuel = Lib\Fuel::getFuelList(null, $fuelCostsID); $arFuel = $arFuel[0]; //msDebug($arFuel); ?> <form action="" method="post"> <input type="hidden" name="id" value="<?php echo $fuelCostsID; ?> "> <table class="add_ts"> <tr> <td class="title">Автомобиль</td> <td><?php echo Lib\MyCar::showSelectCars("my_car", $arFuel['MY_CAR_ID'], 'class="myCar"'); ?> </td> </tr> <tr> <td class="title">Дата</td> <td><?php echo InputCalendar('date', $arFuel['DATE'], 'class="calendarDate"', $strId = ""); ?> </td> </tr> <tr> <td class="title">Пробег</td> <td><?php echo InputType('text', 'odo', $arFuel['ODO'], '', false, '', 'class="odo"'); ?>
<?php include_once __DIR__ . "/../include/header.php"; MSergeev\Core\Lib\Buffer::setTitle("Пробег"); use MSergeev\Packages\Icar\Lib; $defaultCar = Lib\MyCar::getDefaultCarID(); ?> <p>Статистика для: <?php echo Lib\MyCar::showSelectCars("my_car", $defaultCar, 'class="myCar"'); ?> <br><br></p> <p><a class="linkAdd" href="add.php">Добавить маршрут</a></p> <p><select name="period" id="period_select"> <option value="1" selected>Текущий месяц</option> <option value="2">Прошлый месяц</option> <option value="3">За год</option> </select> Показать за период с <?php echo InputCalendar('from', date("d.m.Y"), 'class="calendarFrom"', $strId = ""); ?> по <?php echo InputCalendar('to', date("d.m.Y"), 'class="calendarTo"', $strId = ""); ?> <a href="#">Показать</a></p> <div class="charts"><?php echo Lib\Odo::showChartsOdo('01.' . date("m.Y"), date("d.m.Y"), $defaultCar); ?> </div>