$real_quantity = $_REQUEST['quantity']; $real_cost = $_REQUEST['cost']; $c_id = $_REQUEST['c_id']; $str = substr($overhead_detail_id, 0, 1); CorrectionDone($overhead_detail_id, $real_quantity, $real_cost); if ($str == 'O') { $g_id = substr($overhead_detail_id, 1); UpdateDocDetail($g_id, $real_quantity, $real_cost); } else { UpdateDocDetail($overhead_detail_id, $real_quantity, $real_cost); } break; case 'insert-details': $l_id = $_REQUEST[l_id]; $doc = $_REQUEST[doc_numb]; $check = GetDocType($doc); if ($check) { InsertDocDetails($doc, $l_id); } else { InsertDocDetailsB($doc, $l_id); } break; case 'save_correction': $id = $_REQUEST['id']; InsertCorrection($id); break; case 'clear_db': ClearDB(); break; default: $error = 'Action is Null';
$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_list_diff': $count = $_REQUEST['count']; $hidden = $_REQUEST['hidden']; $doc_numb = $_REQUEST['doc_numb']; $check = GetDocType($doc_numb); mysql_query("SET @i = 0;"); if ($check) { $rResult = mysql_query("SELECT DISTINCT CONCAT('O', `overhead_detail`.`id`) AS `id`,\r\n \t\t\t\t\t@i := @i + 1 AS `iterator`,\r\n \t\t\t\t\t`overhead_detail`.`name` AS `goods_name`,\r\n \t\t\t\t\t`production`.`name`,\r\n \t\t\t\t\t`overhead_correction_detail`.`new_quantity` - `overhead_correction_detail`.`old_quantity`,\r\n \t\t\t\t\t`overhead_correction_detail`.`new_cost` - `overhead_correction_detail`.`old_cost`,\r\n \t\t\t\t\t(`overhead_correction_detail`.`new_quantity` - `overhead_correction_detail`.`old_quantity`) * (`overhead_correction_detail`.`new_cost` - `overhead_correction_detail`.`old_cost`)\r\n \t\t\t\t\tFROM `overhead_correction_detail`\r\n\t\t\t\t\t\t\t JOIN overhead_detail ON overhead_detail.id = overhead_correction_detail.overhead_detail_id\r\n\t\t\t\t\t\t\t JOIN overhead ON overhead.id = overhead_detail.overhead_id\r\n \t\t\t\t\t JOIN `production_identity` ON `overhead_detail`.`name` = `production_identity`.`rs_name`\r\n \t\t\t\t\t JOIN `production` ON `production_identity`.`production_id` = `production`.`id`\r\n \t\t\t\t\t JOIN `overhead_identity` ON `overhead_detail`.`overhead_id` = `overhead_identity`.`overhead_id` && `production_identity`.`id` = `overhead_identity`.`identity_id` && `overhead_detail`.`id` = `overhead_identity`.`overhead_detail_id`\r\n \t\t\t\t\tWHERE overhead.waybill_number = '{$doc_numb}' AND overhead.waybill_number != ''\r\n\r\n/*\r\nSELECT `overhead_detail`.`id` AS `id`,\r\n \t\t\t\t\t@i := @i + 1 AS `iterator`,\r\n \t\t\t\t\t`overhead_detail`.`name` AS `goods_name`,\r\n \t\t\t\t\t`overhead_detail`.`name` AS `goods_name`,\r\n \t\t\t\t\t`overhead_correction_detail`.`new_quantity` - `overhead_correction_detail`.`old_quantity`,\r\n \t\t\t\t\t`overhead_correction_detail`.`new_cost` - `overhead_correction_detail`.`old_cost`,\r\n \t\t\t\t\t(`overhead_correction_detail`.`new_quantity` - `overhead_correction_detail`.`old_quantity`) * (`overhead_correction_detail`.`new_cost` - `overhead_correction_detail`.`old_cost`)\r\n \t\r\n\t\t\t\t\t\t\t\t\t\tFROM `overhead_correction_detail`\r\n\t\t\t\t\t\t\t\t\t\t JOIN overhead_detail ON overhead_detail.id = overhead_correction_detail.overhead_detail_id\r\n\t\t\t\t\t\t\t\t\t\t JOIN overhead ON overhead.id = overhead_detail.overhead_id\r\n\t\t\t \t\t\tWHERE overhead.waybill_number = '{$doc_numb}' AND overhead.waybill_number != ''\r\n*/\r\n \t\t\t\t\t"); } else { $rResult = mysql_query("SELECT `overhead_detail`.`id` AS `id`,\r\n \t\t\t\t\t@i := @i + 1 AS `iterator`,\r\n \t\t\t\t\t`overhead_detail`.`name` AS `goods_name`,\r\n \t\t\t\t\t`overhead_detail`.`name` AS `goods_name`,\r\n \t\t\t\t\t`overhead_correction_detail`.`new_quantity` - `overhead_correction_detail`.`old_quantity`,\r\n \t\t\t\t\t`overhead_correction_detail`.`new_cost` - `overhead_correction_detail`.`old_cost`,\r\n \t\t\t\t\t(`overhead_correction_detail`.`new_quantity` - `overhead_correction_detail`.`old_quantity`) * (`overhead_correction_detail`.`new_cost` - `overhead_correction_detail`.`old_cost`)\r\n \t\r\n\t\t\t\t\t\t\t\t\t\tFROM `overhead_correction_detail`\r\n\t\t\t\t\t\t\t\t\t\t JOIN overhead_detail ON overhead_detail.id = overhead_correction_detail.overhead_detail_id\r\n\t\t\t\t\t\t\t\t\t\t JOIN overhead ON overhead.id = overhead_detail.overhead_id\r\n\t\t\t \t\t\tWHERE overhead.waybill_number = '{$doc_numb}' AND overhead.waybill_number != ''"); } $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] . '" />'; }