$log = new log(); $action = $_REQUEST['act']; $error = ''; $data = ''; switch ($action) { case 'get_add_page': $page = GetPage(); $data = array('page' => $page); break; case 'get_edit_page': $rec_id = $_REQUEST['id']; $page = GetPage(GetRecipie($rec_id)); $data = array('page' => $page); break; case 'get_local_id': $data = array('local_id' => GetLocalID()); break; case 'get_list': $count = $_REQUEST['count']; $hidden = $_REQUEST['hidden']; $rResult = mysql_query("SELECT production.`id`, \r\n\t\t\t\t\t\t\t\t\t\t`production`.`name`,\r\n\t\t\t\t\t\t\t\t\t\tROUND(SUM((SELECT DISTINCT reserve.price FROM reserve WHERE reserve.production_id = rec.ingredient_id ) * rec.quantity * rec.default_amount),4) AS `self_price` \r\n\t\t\t\t\t\t\t\t\t\tFROM `recipie` AS rec \r\n\t\t\t\t\t\t\t\t\t\tLEFT JOIN `production` ON `production`.`id` = `rec`.`recipie_id`\r\n\t\t\t\t\t\t\t\t\t\tWHERE `production`.`id` IN (SELECT `recipie_id` FROM `recipie`) AND `production`.`actived` = 1\r\n\t\t\t\t\t\t\t\t\t\tGROUP BY rec.recipie_id"); $data = array("aaData" => array()); if (!$rResult) { $error = 'Invalid query: ' . mysql_error(); } else { while ($aRow = mysql_fetch_array($rResult)) { $row = array(); for ($i = 0; $i < $count; $i++) { /* General output */ $row[] = $aRow[$i]; if ($i == $count - 1) {
$rResult = mysql_query("SELECT\r\n\t\t\t\t\t\t\t\t\t\t\t`c_person`,\r\n\t\t\t\t\t\t\t\t\t\t\t`phone`,\r\n\t\t\t\t\t\t\t\t\t\t\t`email`\r\n\t\t\t\t\t\t\t\t\tFROM `bank_person`\r\n\t\t\t\t\t\t\t\t\tWHERE\t c_person={$object_id} AND actived=1"); $data = array("aaData" => array()); while ($aRow = mysql_fetch_array($rResult)) { $row = array(); for ($i = 0; $i < $count; $i++) { /* General output */ $row[] = $aRow[$i]; if ($i == $count - 1) { $row[] = '<input type="checkbox" name="check_' . $aRow[$hidden] . '" class="check" value="' . $aRow[$hidden] . '" />'; } } $data['aaData'][] = $row; } break; case 'get_local_id': $increment_id = GetLocalID(); $data = array('increment' => $increment_id); break; case 'disable': Deleteobj($_REQUEST['id']); break; default: $error = 'Action is Null'; } $data['error'] = $error; echo json_encode($data); /* ****************************** * Recipie obj List Functions * ****************************** */ function Addbank_object($bank_object_name, $bank_object_address)
Done($describe_id, $user_id, $object_id, $c_date); break; case 'check_prod_list': $describe_id = $_REQUEST['id']; $check = CheckProdList($describe_id); if ($check) { $error = 'პროდუქციის სია ცარიელია!'; } break; case 'get_production_quantity': $production_name = $_REQUEST['pn']; $object_id = $_REQUEST['ob']; $data = array('quantity' => GetQuantity($production_name, $object_id)); break; case 'get_local_id': $local_id = GetLocalID(); $data = array('local_id' => $local_id); break; case 'clear_db': ClearDB(); break; default: $error = 'Action is Null'; } $data['error'] = $error; echo json_encode($data); /* ****************************** * Transfer Functions * ****************************** */ function ClearDB()
function GetCalientCallPage($id) { if ($id == '') { $res['id'] = GetLocalID(); } else { $res = GetCall($id); } $data = ' <div id="dialog-form"> <fieldset> <legend>ძირითადი ინფორმაცია</legend> <table class="dialog-form-table"> <tr> <td style="width: 170px;"><label for="client_object">კლიენტი</label></td> <td> <div class="seoy-row" id="client_object_seoy"> <input type="text" id="client_object" class="idle seoy-large" onblur="this.className=\'idle seoy-large\'" onfocus="this.className=\'activeField seoy-large\'" value="' . $res['client'] . '" /> <button id="client_object_btn" class="combobox">client_object</button> </div> </td> </tr> <tr> <td style="width: 170px;"><label for="per_contact_person">საკონტაქტო პირი</label></td> <td> <select id="persons" class="idls date_time" style="width: 165px !important;">' . GetPersons($res['id']) . '</select> </td> </tr> <tr> <td style="width: 170px;"><label for="per_phone_number">ტელ. ნომერი</label></td> <td> <input type="text" id="per_phone_number" class="idle" onblur="this.className=\'idle\'" onfocus="this.className=\'activeField\'" value="' . $res['phone'] . '" /> </td> </tr> <tr> <td style="width: 170px;"><label for="per_mail">ელ-ფოსტა</label></td> <td> <input type="text" id="per_mail" class="idle" onblur="this.className=\'idle\'" onfocus="this.className=\'activeField\'" value="' . $res['mail'] . '" /> </td> </tr> <tr> <td style="width: 170px;"><label for="service_degree">მომსახურების დონე</label></td> <td> <select id="service_degree" class="idls date_time" style="width: 165px !important;">' . GetServiceDegree($res['degree_type']) . '</select> </td> </tr> <tr> <td style="width: 170px;" valign="top"><label for="call_date">თარიღი</label></td> <td><input id="call_date" type="text" class="idle date_time" onblur="this.className=\'idle date_time\'" onfocus="this.className=\'activeField date_time\'" value="' . $res['call_date'] . '" /></td> </tr> <tr class="comment"> <td style="width: 170px;" valign="top"><label for="per_comment">შენიშვნა</label></td> <td> <textarea id="per_comment" class="idle large" cols="40" rows="3">' . $res['comment'] . '</textarea> </td> </tr> </table> <!-- ID --> <input type="hidden" id="servise_degree_id" value="' . $res['id'] . '" /> <input type="hidden" id="client_name" value="" /> </fieldset> </div>'; return $data; }