function __construct($_idClient, $firm) { $this->idClient = null; if (is_numeric($_idClient)) { $this->idClient = $_idClient; } if (!is_null($this->idClient)) { $this->pdo = Database::connect($firm); $sqlC = $this->pdo->prepare('SELECT * FROM ������� WHERE ����������= :idK'); $sqlC->bindParam(':idK', $this->idClient, PDO::PARAM_INT); $sqlC->execute(); if ($sqlC->rowCount()) { $rowC = $sqlC->fetch(); if (!is_null($rowC)) { $this->companyName = $rowC['����������������']; $this->nameClient = $rowC['�����������']; $this->famClient = $rowC['���������������']; $this->address = $rowC['���������������������']; $this->city = $rowC['�����']; $this->postIndex = $rowC['��������������']; $this->land = $rowC['������']; $this->position = $rowC['�������������������']; $this->tel = $rowC['�������������']; $this->fax = $rowC['����']; $this->unn = $rowC['UNN']; $this->lProblem = $rowC['LProblem']; $this->sex = $rowC['Sex']; $this->bankRekv = $rowC['BankRekv']; $this->lSel = $rowC['LSel']; $this->email = $rowC['Email']; } } } }
function __construct($_idOrder, $firm) { $this->idOrder = $_idOrder; $this->pdo = Database::connect($firm); $sql = $this->pdo->prepare(iconv("UTF-8", "WINDOWS-1251", 'SELECT * FROM "Заказы на ремонт" WHERE КодЗаказа = :id')); $sql->bindParam(':id', $this->idOrder, PDO::PARAM_INT); $sql->execute(); if ($sql->rowCount()) { $rowO = $sql->fetch(); $this->client = new Clients($rowO[iconv("UTF-8", "WINDOWS-1251", 'КодКлиента')], $firm); } }
$pdo = null; if (isset($_POST['date'])) { $curDate_array = getdate(strtotime($_POST['date'])); $curDateBegin = '#' . $curDate_array['year'] . '/' . $curDate_array['mday'] . '/' . $curDate_array['mon'] . ' 0:0:0' . '#'; $curDateEnd = '#' . $curDate_array['year'] . '/' . $curDate_array['mday'] . '/' . $curDate_array['mon'] . ' 23:59:59' . '#'; } if (isset($_POST['firm'])) { $curFirm = $_POST['firm']; } switch ($curFirm) { case '10': $pdo = Database::connect('BTS'); $curFirmStr = 'BTS'; break; case '11': $pdo = Database::connect('LETTA'); $curFirmStr = 'LETTA'; break; } if (isset($_POST['action'])) { switch ($_POST['action']) { case 'refreshP': $sql = iconv("UTF-8", "WINDOWS-1251", 'SELECT TOP 10 * FROM "Заказы на ремонт" WHERE ([ДатаП]>=' . $curDateBegin . ' AND [ДатаП]<=' . $curDateEnd . ') ORDER BY НомерЗаказа DESC'); $tableBody = ''; foreach ($pdo->query($sql) as $row) { $order = new Orders($row[iconv("UTF-8", "WINDOWS-1251", 'КодЗаказа')], $curFirmStr); $tableBody .= '<tr>'; $tableBody .= '<td>' . $order->getTypeOrder() . '</td>'; $tableBody .= '<td>' . $order->getLeaveOrder() . '</td>'; $tableBody .= '<td>' . $row[iconv("UTF-8", "WINDOWS-1251", 'НомерЗаказа')] . '</td>'; $tableBody .= '<td>' . $order->getStatusOrder() . '</td>';