class muneem of keepsizeCform custom from "keepsize.cfm" //class muneem of FORM custom with (this) colorNormal = "0xbffffe" height = 27.1364 left = 80.1429 top = 0.0 width = 160.7143 text = "" clientEdge = true windowState = 2 // Maximized autoCenter = true endwith function add_item() on key label esc keyboard "{ALT+I}" form.additem.enabled = true form.additem.visible = true form.additem.mcomp.value = mo_item.company form.additem.mitem.value = mo_item.item form.additem.mdescrip.value = mo_item.descrip form.additem.mmrp.value = mo_item.mrp form.additem.mdisc.value = mo_item.disc form.additem.mqty.value = 0 form.additem.mmisc.value = 0 // if mo_item.offerp >0 // form.additem.mrate.value = mo_item.offerp // else // form.additem.mrate.value = mo_item.mrp*(1-mo_item.disc/100) // form.additem.mrate.value = round(form.additem.mrate.value,0) // endif form.additem.mrate.value = mo_item.mrp*(1-mo_item.disc/100) form.additem.mrate.value = round(form.additem.mrate.value,0) if mo_item.offerp >0 and mo_item.mrp > 0 form.additem.mmisc.value = form.additem.mrate.value-mo_item.offerp else if mo_item.offerp >0 and mo_item.mrp = 0 form.additem.mrate.value = mo_item.offerp endif form.additem.mcomment.value="COMMENT" form.additem.mrate.setfocus() if type("mo_item.bcde")#"U" and mo_item.bcde form.additem.mqty.value = 1 form.additem.itemsave.setfocus() endif return function update_inv parameters mrec,mqty,mlocation,msell , mrate if mlocation $ "012" and mrec >0 do case case mlocation ="0" mloc = 'hoqty' case mlocation = "1" mloc = 'go1qty' case mlocation = "2" mloc = 'go2qty' endcase if "KAPOORSONS" $ mcompany.company and mlocation = "1" cmd = "update inve"+mcompany.fyear+" SET " + mloc +" = "+ mloc +" - "+ mqty if mrate > 0 cmd+= " ,"+ msell + "= "+ mrate endif cmd += " WHERE recno = " + mrec else cmd = "update inve"+mcompany.fyear+" SET " + mloc +" = "+ mloc +" - "+ mqty if mrate > 0 cmd+= " ,"+ msell + "= "+ mrate endif cmd += " WHERE recno = " + mrec +" AND generic" endif mcompany.adodb.executesql(cmd) else if mrec <=0 //msgbox("mrec is zero or less than 0") else //msgbox("Unknown location cannot update inventory") endif endif return function num_onOpen() parameters repeat if not repeat #include winuser.h if type("GetCurrentThreadId") # "FP" extern CULONG GetCurrentThreadId() kernel32 from "GetCurrentThreadId" endif if type("GetWindowLong") # "FP" extern CLONG GetWindowLong(CHANDLE, CINT) user32 from "GetWindowLongW" endif if type("SetWindowsHookEx") # "FP" extern CLONG SetWindowsHookEx(CINT, CPTR, CHANDLE, CULONG) user32 from "SetWindowsHookExW" endif if type("UnhookWindowsHookEx") # "FP" extern CLOGICAL UnhookWindowsHookEx(CHANDLE) user32 from "UnhookWindowsHookEx" endif if type("CallNextHookEx") # "FP" extern CLONG CallNextHookEx(CHANDLE, CINT, CUINT, CUINT) user32 from "CallNextHookEx" endif if type("GetAsyncKeyState") # "FP" extern CSHORT GetAsyncKeyState(CSHORT) user32 endif CALLBACK CLONG hookWndProc(CINT, CUINT, CUINT) OBJECT this endif this.hookProc = GetCallAddress(class::HOOKWNDPROC) this.hInst = GetWindowLong(form.hwnd, GWL_HINSTANCE) this.hook = SetWindowsHookEx(WH_KEYBOARD, form.hookProc, this.hInst, GetCurrentThreadId()) return function num_canClose UnhookWindowsHookEx(this.hook) return true function num_key_pressed(num_key) if num_key = 0x60 cKey = 'VK_NUMPAD0' keyboard "0" elseif num_key = 0x61 cKey ='VK_NUMPAD1' keyboard "1" elseif num_key = 0x62 cKey ='VK_NUMPAD2' keyboard "2" elseif num_key = 0x63 cKey ='VK_NUMPAD3' keyboard "3" elseif num_key = 0x64 cKey ='VK_NUMPAD4' keyboard "4" elseif num_key = 0x65 cKey ='VK_NUMPAD5' keyboard "5" elseif num_key = 0x66 cKey ='VK_NUMPAD6' keyboard "6" elseif num_key = 0x67 cKey ='VK_NUMPAD7' keyboard "7" elseif num_key = 0x68 cKey ='VK_NUMPAD8' keyboard "8" elseif num_key = 0x69 cKey ='VK_NUMPAD9' keyboard "9" elseif num_key = 0x6B cKey ='VK_NUMPAD+' keyboard "+" elseif num_key = 0x6A cKey ='VK_NUMPAD*' keyboard "*" elseif num_key = 0x6C cKey ='VK_NUMPAD/' keyboard "/" elseif num_key = 0x6D cKey ='VK_NUMPAD-' keyboard "-" elseif num_key = 0x6E cKey ='VK_NUMPAD.' keyboard "." elseif num_key = 0x6F cKey ='VK_NUMPAD/' keyboard "/" endif return function hookWndproc(hCode, wParam, lParam) cRet = CallNextHookEx(this.hook, hCode, wParam, lParam) if wParam >= VK_NUMPAD0 and wParam <= VK_DIVIDE and hcode = 0 and (not bitset(lparam,31)) if not bitset(GetAsyncKeyState(VK_MENU),31) //Alt key down class::num_key_pressed(wParam) cRet = 1 //Hot key. Don't pass key press on to next hook for processing. else cRet = CallNextHookEx(this.hook, hCode, wParam, lParam) //Not a hot key. Process key press endif endif return cRet // function editorControl_beforeCellPaint(bSelectedRow) // if this.parent.parent.invedatamodule1.inve.rowset.fields["clearance"].value=1 // if.not.bSelectedRow // this.colorNormal = "red/0xbffffe" // else // this.colornormal = "white" // endif // else // if.not.bSelectedRow // this.colornormal = "" // endif // endif // return true endclass