Material receiving with master detail

Hi,

Can you please guide me for material receiving like POS system. There will be a field in master form name: {item_number}. Onblur ajax event of this field data will be inserted using below query:

$insert_sql=“INSERT INTO pos.ospos_receivings_items
(receiving_id,
name,
category,
supplier_id,
item_number)VALUES
(’{receiving_id}’,
‘{name}’,
‘{category}’,
‘{supplier_id}’,
‘{item_number}’)”;

sc_exec_sql($insert_sql);

Then editable gird (detail form) will be appeared with below option

[ATTACH=CONFIG]n81776[/ATTACH]

Then another onblur event will insert data and the abode detail form will be refreshed. How can I do this?

Please help.

Thanks

Untitled.png