QA Inspection: get_query

This commit is contained in:
Nabin Hait 2011-10-05 16:57:36 +05:30
parent 1971942db8
commit 5630049d2a

View File

@ -1,26 +1,44 @@
cur_frm.cscript.item_code = function(doc, cdt, cdn) {
if (doc.item_code)
get_server_fields('get_purchase_receipt_item_details','','',doc,cdt,cdn,1);
if (doc.item_code)
get_server_fields('get_purchase_receipt_item_details','','',doc,cdt,cdn,1);
}
cur_frm.cscript.inspection_type = function(doc, cdt, cdn) {
if(doc.inspection_type == 'Incoming'){
doc.delivery_note_no = '';
hide_field('delivery_note_no');
unhide_field('purchase_receipt_no');
}
else if(doc.inspection_type == 'Outgoing'){
doc.purchase_receipt_no = '';
unhide_field('delivery_note_no');
hide_field('purchase_receipt_no');
if(doc.inspection_type == 'Incoming'){
doc.delivery_note_no = '';
hide_field('delivery_note_no');
unhide_field('purchase_receipt_no');
}
else if(doc.inspection_type == 'Outgoing'){
doc.purchase_receipt_no = '';
unhide_field('delivery_note_no');
hide_field('purchase_receipt_no');
}
else {
doc.purchase_receipt_no = '';
doc.delivery_note_no = '';
hide_field('purchase_receipt_no');
hide_field('delivery_note_no');
}
}
else {
doc.purchase_receipt_no = '';
doc.delivery_note_no = '';
hide_field('purchase_receipt_no');
hide_field('delivery_note_no');
}
}
cur_frm.cscript.refresh = cur_frm.cscript.inspection_type;
cur_frm.cscript.refresh = cur_frm.cscript.inspection_type;
// item code based on GRN/DN
cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) {
if (doc.purchase_receipt_no)
return 'SELECT item_code, item_name, description FROM `tabPurchase Receipt Detail` WHERE parent = "'+ doc.purchase_receipt_no +'" and docstatus != 2 AND item_code LIKE "%s" ORDER BY item_code ASC LIMIT 50';
else if (doc.delivery_note_no)
return 'SELECT item_code, item_name, description FROM `tabDelivery Note Detail` WHERE parent = "'+ doc.delivery_note_no +'" and docstatus != 2 AND item_code LIKE "%s" ORDER BY item_code ASC LIMIT 50';
else
return 'SELECT name, item_name, description FROM tabItem WHERE docstatus != 2 AND %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50';
}
// Serial No based on item_code
cur_frm.fields_dict['item_serial_no'].get_query = function(doc, cdt, cdn) {
if (doc.item_code)
return 'SELECT name, item_code, warehouse FROM `tabSerial No` WHERE docstatus != 2 AND item_code = "' + doc.item_code +'" AND status = "In Store" AND %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50';
else
return 'SELECT name, item_code, warehouse FROM `tabSerial No` WHERE docstatus != 2 AND status = "In Store" AND %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50';
}