function process_refundment_search($window, $id, $ctrl) { global $wb; switch ($id) { case IDC_SEARCH_SUBMIT: $wb->current_page = 1; $wb->keyword = wb_get_text(wb_get_control($window, IDC_KEYWORD)); reset_refundment_view(); wb_destroy_window($window); break; case IDCLOSE: // IDCLOSE is predefined // IDCLOSE is predefined case IDCANCEL: // set_default_accel(); wb_destroy_window($window); break; } }
function inser_update_refundment($parent) { global $wb; $ctrl_map = refundment_ctrl_mapping(); $table_name = $wb->setting["Settings"]["refundment_table"]; $set_str = ""; while (list($ctrl_name, $field_name) = each($ctrl_map)) { $value = wb_get_text(wb_get_control($parent, $ctrl_name)); $set_str .= "{$field_name}='{$value}',"; } $set_str = rtrim($set_str, ','); if ($wb->current_action == 'update') { $id = $wb->current_ids; $sql = "UPDATE {$table_name} SET {$set_str} WHERE id='{$id}' "; } else { $sql = "INSERT INTO {$table_name} SET {$set_str} "; } $wb->db->query($sql); reset_refundment_view(); }
function process_refundment($window, $id, $ctrl, $lparam1 = 0, $lparam2 = 0) { global $wb; switch ($id) { case IDC_NAV_FIRST: $wb->current_page = 1; reset_refundment_view(); break; case IDC_NAV_PRE: $wb->current_page -= 1; $wb->current_page = $wb->current_page < 1 ? 1 : $wb->current_page; reset_refundment_view(); break; case IDC_NAV_NEXT: $wb->current_page += 1; $wb->current_page = $wb->current_page > $wb->total_page ? $wb->total_page : $wb->current_page; reset_refundment_view(); break; case IDC_NAV_LAST: $wb->current_page = $wb->total_page; reset_refundment_view(); break; case IDC_REFUNDMENT_LIST: if ($lparam1 == WBC_DBLCLICK) { $current_rows = wb_get_text($ctrl); $current_id = $current_rows[0][0]; $wb->current_ids = $current_id; $wb->current_form_state = false; $wb->current_action = 'update'; if ($wb->current_ids) { include_once PATH_FORM . "yc_refundment_edit.form.inc.php"; create_refundment_edit_dlg(); } } // Show current selection and checked items $sel = wb_get_selected($ctrl); $sel = $sel ? implode(", ", $sel) : "none"; $contents = wb_get_text($ctrl); $text = ""; if ($contents) { foreach ($contents as $row) { $text .= $row ? "[" . implode(", ", $row) . "] " : ""; } } $checked = wb_get_value($ctrl); $temp_str = ""; if ($checked) { foreach ($checked as $value) { $row_data = wb_get_text($ctrl, $value, 0); $temp_str .= $row_data . ","; } $del_ids = rtrim($temp_str, ','); $wb->del_ids = $del_ids; } $checked = $checked ? implode(", ", $checked) : "none"; wb_set_text($wb->statusbar, "Selected lines: " . $sel . " / checked: " . $checked . " / deleted: " . $del_ids . " / contents: " . $text); break; case IDC_REFUNDMENT_CATEGORY_LIST: if ($lparam1 == WBC_DBLCLICK) { $current_rows = wb_get_text($ctrl); $current_id = $current_rows[0][0]; $wb->current_ids = $current_id; $wb->current_form_state = false; $wb->current_action = 'update'; if ($wb->current_ids) { include_once PATH_FORM . "yc_refundment_category_edit.form.inc.php"; create_refundment_category_edit_dlg(); } } // Show current selection and checked items $sel = wb_get_selected($ctrl); $sel = $sel ? implode(", ", $sel) : "none"; $contents = wb_get_text($ctrl); $text = ""; if ($contents) { foreach ($contents as $row) { $text .= $row ? "[" . implode(", ", $row) . "] " : ""; } } $checked = wb_get_value($ctrl); $temp_str = ""; if ($checked) { foreach ($checked as $value) { $row_data = wb_get_text($ctrl, $value, 0); $temp_str .= $row_data . ","; } $del_ids = rtrim($temp_str, ','); $wb->del_ids = $del_ids; } $checked = $checked ? implode(", ", $checked) : "none"; wb_set_text($wb->statusbar, "Selected lines: " . $sel . " / checked: " . $checked . " / deleted: " . $del_ids . " / contents: " . $text); break; } }