local f f = new e_salesform() f.mdi = false // ensure not MDI f.readModal() f.release() //on key return ** END HEADER -- do not remove this line // // Generated on 24.05.2020 // parameter bModal local f f = new e_salesform() if (bModal) f.mdi = false // ensure not MDI f.readModal() else f.open() endif class e_salesform of MUNEEM from "muneem.cfm" set procedure to inve.dmd additive set procedure to sales2.dmd additive set procedure to toggle.cc additive set procedure to mun_controls.cc additive with (this) canClose = class::FORM_CANCLOSE onOpen = class::FORM_ONOPEN onClose = class::NUM_CANCLOSE height = 31.5 left = 0.4286 top = -0.5455 width = 214.5714 text = "Cash Memo Entry" escExit = false endwith this.INVEDATAMODULE1 = new INVEDATAMODULE() this.INVEDATAMODULE1.parent = this with (this.INVEDATAMODULE1) left = 37.0 top = 18.0 width = 12.0 height = 1.0 endwith this.SALESDATAMODULE1 = new SALESDATAMODULE() this.SALESDATAMODULE1.parent = this with (this.SALESDATAMODULE1) left = 9.0 top = 18.0 width = 13.0 height = 1.0 endwith this.ADDITEM = new ADDITEM(this) with (this.ADDITEM) visible = false left = 1.0 top = 18.5 width = 153.0 height = 4.5 endwith with (this.ADDITEM.MDESCRIP) onGotFocus = class::MDESCRIP_ONGOTFOCUS endwith with (this.ADDITEM.ITEMDISCARD) onClick = class::ITEMDISCARD_ONCLICK endwith this.SALES = new MUN_GRID(this) with (this.SALES) onGotFocus = class::SALES_ONGOTFOCUS onLostFocus = class::SALES_ONLOSTFOCUS dataLink = form.salesdatamodule1.sales.rowset columns["COLUMN1"] = new GRIDCOLUMN(form.SALES) with (columns["COLUMN1"]) dataLink = form.salesdatamodule1.sales.rowset.fields["company"] editorType = 1 // EntryField width = 14.2857 endwith columns["COLUMN2"] = new GRIDCOLUMN(form.SALES) with (columns["COLUMN2"]) dataLink = form.salesdatamodule1.sales.rowset.fields["item"] editorType = 1 // EntryField width = 14.2857 endwith columns["COLUMN3"] = new GRIDCOLUMN(form.SALES) with (columns["COLUMN3"]) dataLink = form.salesdatamodule1.sales.rowset.fields["descrip"] editorType = 1 // EntryField width = 35.0 endwith columns["COLUMN4"] = new GRIDCOLUMN(form.SALES) with (columns["COLUMN4"]) dataLink = form.salesdatamodule1.sales.rowset.fields["mrp"] editorType = 1 // EntryField width = 14.0 endwith columns["COLUMN5"] = new GRIDCOLUMN(form.SALES) with (columns["COLUMN5"]) dataLink = form.salesdatamodule1.sales.rowset.fields["disc"] editorType = 1 // EntryField width = 8.0 endwith columns["COLUMN6"] = new GRIDCOLUMN(form.SALES) with (columns["COLUMN6"]) dataLink = form.salesdatamodule1.sales.rowset.fields["rate"] editorType = 1 // EntryField width = 14.0 endwith columns["COLUMN7"] = new GRIDCOLUMN(form.SALES) with (columns["COLUMN7"]) dataLink = form.salesdatamodule1.sales.rowset.fields["misc"] editorType = 1 // EntryField width = 14.0 endwith columns["COLUMN8"] = new GRIDCOLUMN(form.SALES) with (columns["COLUMN8"]) dataLink = form.salesdatamodule1.sales.rowset.fields["qty"] editorType = 1 // EntryField width = 12.0 endwith columns["COLUMN9"] = new GRIDCOLUMN(form.SALES) with (columns["COLUMN9"]) dataLink = form.salesdatamodule1.sales.rowset.fields["amount"] editorType = 1 // EntryField width = 15.0 endwith columns["COLUMN10"] = new GRIDCOLUMN(form.SALES) with (columns["COLUMN10"]) dataLink = form.salesdatamodule1.sales.rowset.fields["cgst"] editorType = 1 // EntryField width = 12.0 endwith columns["COLUMN11"] = new GRIDCOLUMN(form.SALES) with (columns["COLUMN11"]) dataLink = form.salesdatamodule1.sales.rowset.fields["sgst"] editorType = 1 // EntryField width = 12.0 endwith columns["COLUMN12"] = new GRIDCOLUMN(form.SALES) with (columns["COLUMN12"]) dataLink = form.salesdatamodule1.sales.rowset.fields["goods"] editorType = 1 // EntryField width = 15.0 endwith columns["COLUMN13"] = new GRIDCOLUMN(form.SALES) with (columns["COLUMN13"]) dataLink = form.salesdatamodule1.sales.rowset.fields["hsn_code"] editorType = 1 // EntryField width = 11.0 endwith columns["COLUMN14"] = new GRIDCOLUMN(form.SALES) with (columns["COLUMN14"]) dataLink = form.salesdatamodule1.sales.rowset.fields["comment"] editorType = 1 // EntryField width = 21.0 endwith columns["COLUMN15"] = new GRIDCOLUMN(form.SALES) with (columns["COLUMN15"]) dataLink = form.salesdatamodule1.sales.rowset.fields["tax"] editorType = 1 // EntryField width = 8.0 endwith columns["COLUMN16"] = new GRIDCOLUMN(form.SALES) with (columns["COLUMN16"]) dataLink = form.salesdatamodule1.sales.rowset.fields["adtax"] editorType = 1 // EntryField width = 8.0 endwith columns["COLUMN17"] = new GRIDCOLUMN(form.SALES) with (columns["COLUMN17"]) dataLink = form.salesdatamodule1.sales.rowset.fields["unit"] editorType = 1 // EntryField width = 14.0 endwith columns["COLUMN18"] = new GRIDCOLUMN(form.SALES) with (columns["COLUMN18"]) dataLink = form.salesdatamodule1.sales.rowset.fields["full"] editorType = 1 // EntryField width = 28.0 endwith with (columns["COLUMN1"].headingControl) value = "company" endwith with (columns["COLUMN2"].headingControl) value = "item" endwith with (columns["COLUMN3"].headingControl) value = "descrip" endwith with (columns["COLUMN4"].editorControl) picture = "99,99,999.99" function = "ZJ" endwith with (columns["COLUMN4"].headingControl) value = "mrp" endwith with (columns["COLUMN5"].editorControl) picture = "99.99%" function = "ZJ" endwith with (columns["COLUMN5"].headingControl) value = "disc" endwith with (columns["COLUMN6"].editorControl) picture = "99,99,999.99" function = "ZJ" endwith with (columns["COLUMN6"].headingControl) value = "rate" endwith with (columns["COLUMN7"].editorControl) picture = "99,99,999.99" function = "ZJ" endwith with (columns["COLUMN7"].headingControl) value = "misc" endwith with (columns["COLUMN8"].editorControl) picture = "9,999.99" function = "ZJ" fontSize = 12.0 fontBold = true endwith with (columns["COLUMN8"].headingControl) value = "qty" endwith with (columns["COLUMN9"].editorControl) picture = "99,99,99,999.99" function = "ZJ" fontSize = 12.0 fontBold = true endwith with (columns["COLUMN9"].headingControl) value = "amount" endwith with (columns["COLUMN10"].editorControl) picture = "99,99,999.99" function = "ZJ" endwith with (columns["COLUMN10"].headingControl) value = "cgst" endwith with (columns["COLUMN11"].editorControl) picture = "99,99,999.99" function = "ZJ" endwith with (columns["COLUMN11"].headingControl) value = "sgst" endwith with (columns["COLUMN12"].editorControl) picture = "99,99,999.99" function = "ZJ" endwith with (columns["COLUMN12"].headingControl) value = "goods" endwith with (columns["COLUMN13"].headingControl) value = "hsn_code" endwith with (columns["COLUMN14"].headingControl) value = "comment" endwith with (columns["COLUMN15"].editorControl) picture = "99.99%" function = "ZJ" endwith with (columns["COLUMN15"].headingControl) value = "tax" endwith with (columns["COLUMN16"].editorControl) picture = "99.99%" function = "ZJ" endwith with (columns["COLUMN16"].headingControl) value = "adtax" endwith with (columns["COLUMN17"].headingControl) value = "unit" endwith with (columns["COLUMN18"].headingControl) value = "unit" endwith borderStyle = 3 // None height = 15.0 left = 0.0 top = 3.0 width = 182.0 endwith this.HEADER = new MUN_CONTAINER(this) with (this.HEADER) left = 0.0 top = 0.0 width = 211.4286 height = 3.0 borderStyle = 3 // None anchor = 2 // Top endwith this.HEADER.CASH_NO = new MUN_TEXT(this.HEADER) with (this.HEADER.CASH_NO) height = 1.0 left = 1.0 top = 0.0909 width = 49.5714 text = "Cash Memo No." pageno = 0 endwith this.HEADER.TDATE = new MUN_TEXTLABEL(this.HEADER) with (this.HEADER.TDATE) height = 1.0 left = 32.5714 top = 0.0 width = 6.0 text = "Date" pageno = 0 endwith this.HEADER.MDATE = new QUICK_DATE(this.HEADER) with (this.HEADER.MDATE) enabled = false height = 1.0 left = 39.5714 top = 0.0 width = 13.0 value = { . . } pageno = 0 endwith this.HEADER.ECNAME = new MUN_ENTRYFIELD(this.HEADER) with (this.HEADER.ECNAME) enabled = false height = 1.0 left = 17.5714 top = 1.3636 width = 30.0 border = false pageno = 0 endwith this.HEADER.ECADDR = new MUN_ENTRYFIELD(this.HEADER) with (this.HEADER.ECADDR) enabled = false height = 1.0 left = 65.5714 top = 1.3636 width = 30.0 border = false pageno = 0 endwith this.HEADER.MOD_CUST = new MUN_PUSH(this.HEADER) with (this.HEADER.MOD_CUST) when = {||type('form.minvoice') #'U' and form.minvoice>0} onClick = class::MOD_CUST_ONCLICK height = 1.5 left = 99.0 top = 1.5 width = 30.0 text = "M&odify" pageno = 0 endwith this.HEADER.DISCARD_CUST = new MUN_PUSH(this.HEADER) with (this.HEADER.DISCARD_CUST) onClick = class::DISCARD_CUST_ONCLICK enabled = false height = 1.5 left = 133.0 top = 1.5 width = 30.0 text = "Disca&rd" pageno = 0 endwith this.HEADER.MLOCATS = new MUN_COMBO(this.HEADER) with (this.HEADER.MLOCATS) when = class::MLOCATS_WHEN onChangeCommitted = class::MLOCATS_ONCHANGE height = 1.1818 left = 63.5714 top = -0.1364 width = 16.0 dataSource = 'array {"Head Office"}' pageno = 0 endwith this.HEADER.TCNAME = new MUN_TEXTLABEL(this.HEADER) with (this.HEADER.TCNAME) height = 1.0 left = -0.4286 top = 1.3636 width = 18.5714 text = "Customer Name :" pageno = 0 endwith this.HEADER.MUN_TEXTLABEL1 = new MUN_TEXTLABEL(this.HEADER) with (this.HEADER.MUN_TEXTLABEL1) height = 1.0 left = 54.5714 top = 0.0909 width = 9.0 text = "Sale At" pageno = 0 endwith this.HEADER.TEXTLABEL1 = new MUN_TEXTLABEL(this.HEADER) with (this.HEADER.TEXTLABEL1) height = 1.0 left = 49.5714 top = 1.3636 width = 18.5714 text = "Customer Addr" pageno = 0 endwith this.HEADER.NEW_CASHNO = new MUN_SPIN(this.HEADER) with (this.HEADER.NEW_CASHNO) onGotFocus = class::NEW_CASHNO_ONGOTFOCUS onLostFocus = class::NEW_CASHNO_ONLOSTFOCUS enabled = true height = 1.0 left = 105.0 top = 0.0 width = 14.0 step = 1.0 rangeMax = 105 value = 1 validRequired = true rangeRequired = true pageno = 0 endwith this.HEADER.GOTO = new MUN_PUSH(this.HEADER) with (this.HEADER.GOTO) onClick = class::GOTO_ONCLICK enabled = true height = 1.25 left = 121.0 top = -0.1818 width = 25.0 text = "Goto Cash memo no." pageno = 0 endwith this.SUBTOTAL = new MUN_TEXTLABEL(this) with (this.SUBTOTAL) height = 1.0 left = 156.0 top = 18.5 width = 27.0 text = "Sub Total" fontBold = false endwith this.CON_DISC = new MUN_CONTAINER(this) with (this.CON_DISC) visible = false enabled = false left = 1.0 top = 18.5 width = 153.0 height = 2.0 endwith this.CON_DISC.EF_DISC = new MUN_ENTRYFIELD(this.CON_DISC) with (this.CON_DISC.EF_DISC) height = 1.1818 left = 47.5714 top = 0.4091 width = 22.0 value = 0.0 pageno = 0 endwith this.CON_DISC.DISC_VAT = new MUN_COMBO(this.CON_DISC) with (this.CON_DISC.DISC_VAT) height = 1.1818 left = 90.5714 top = 0.4091 width = 21.0 pageno = 0 endwith this.CON_DISC.MUN_TEXT1 = new MUN_TEXT(this.CON_DISC) with (this.CON_DISC.MUN_TEXT1) height = 1.0 left = 18.5714 top = 0.5909 width = 28.0 text = "Please enter the Discount" pageno = 0 endwith this.CON_DISC.MUN_TEXTLABEL1 = new MUN_TEXTLABEL(this.CON_DISC) with (this.CON_DISC.MUN_TEXTLABEL1) height = 1.0 left = 72.5714 top = 0.5909 width = 17.0 text = "Vat Rate" pageno = 0 endwith this.CON_DISC.DISC_SAVE = new MUN_PUSH(this.CON_DISC) with (this.CON_DISC.DISC_SAVE) onClick = class::DISC_SAVE_ONCLICK height = 1.25 left = 113.5714 top = 0.3636 width = 15.0 text = "&Save" pageno = 0 endwith this.CON_DISC.DISC_DISCARD = new MUN_PUSH(this.CON_DISC) with (this.CON_DISC.DISC_DISCARD) onClick = class::DISC_DISCARD_ONCLICK height = 1.2273 left = 129.5714 top = 0.3636 width = 15.0 text = "D&iscard" pageno = 0 endwith this.DISCO = new MUN_TEXTLABEL(this) with (this.DISCO) height = 1.0 left = 156.0 top = 19.5 width = 27.0 text = "Discount" endwith this.GTOTAL = new MUN_TEXTLABEL(this) with (this.GTOTAL) height = 1.0 left = 156.0 top = 20.5 width = 27.0 text = "Grand Total" fontBold = false endwith this.TOTAL_QTY = new MUN_TEXT(this) with (this.TOTAL_QTY) height = 2.0 left = 156.0 top = 22.0 width = 27.0 fontBold = false text = "Total Qty" endwith this.FOOTER = new FOOTER(this) with (this.FOOTER) left = 0.0 top = 26.4545 width = 211.4286 height = 3.0 endwith with (this.FOOTER.ADD) when = class::MODIFY_WHEN onClick = class::ADD_ONCLICK endwith with (this.FOOTER.MODIFY) when = class::MODIFY_WHEN onClick = class::MODIFY_ONCLICK left = 21.8571 endwith with (this.FOOTER.DELETE) when = class::MODIFY_WHEN onClick = class::DELETE_ONCLICK left = 43.1429 top = 0.3636 endwith with (this.FOOTER.PRINT) when = class::PRINT_WHEN onClick = class::PRINT_ONCLICK left = 64.4286 top = 0.3636 text = "&* Print" endwith with (this.FOOTER.DISC) when = class::DISC_WHEN onClick = class::DISC_ONCLICK left = 128.2857 top = 0.3636 endwith with (this.FOOTER.CLOSE) left = 85.7143 top = 0.3636 endwith with (this.FOOTER.NEW) left = 107.0 top = 0.3636 endwith this.FOOTER.HALF_PAGE = new TOGGLE(this.FOOTER) with (this.FOOTER.HALF_PAGE) height = 1.0 left = 183.5714 top = 1.4091 width = 7.4286 pageno = 0 borderStyle = 4 // Single endwith this.FOOTER.MUN_TEXT1 = new MUN_TEXT(this.FOOTER) with (this.FOOTER.MUN_TEXT1) height = 1.0 left = 182.5714 top = -0.0909 width = 32.0 text = "Half Page Print" pageno = 0 endwith this.rowset = this.salesdatamodule1.sales.rowset function ADD_onClick() parameters rapid form.dis_able() form.additem.itemsave.onclick = form.save_item if not form.additem.visible if rapid>0 if form.invedatamodule1.inve.rowset.applylocate("recno ="+rapid) //form.invedatamodule1.inve.rowset.applylocate("full ='"+mlastitem+"'") mlastitem = alltrim(form.INVEDATAMODULE1.INVE.rowset.fields["full"].value) mo_item.recno = form.INVEDATAMODULE1.INVE.rowset.fields["recno"].value mo_item.company = form.INVEDATAMODULE1.INVE.rowset.fields["company"].value mo_item.item = form.INVEDATAMODULE1.INVE.rowset.fields["item"].value mo_item.descrip = form.INVEDATAMODULE1.INVE.rowset.fields["descrip"].value mo_item.unit = form.INVEDATAMODULE1.INVE.rowset.fields["unit"].value mo_item.mrp = form.INVEDATAMODULE1.INVE.rowset.fields["mrp"].value mo_item.cprice = form.INVEDATAMODULE1.INVE.rowset.fields["cprice"].value mo_item.disc = form.INVEDATAMODULE1.INVE.rowset.fields["disc"].value mo_item.offerp = form.INVEDATAMODULE1.INVE.rowset.fields["offerp"].value mo_item.tax = val(left(form.INVEDATAMODULE1.INVE.rowset.fields["gst"].value,5)) mo_item.adtax = val(right(form.INVEDATAMODULE1.INVE.rowset.fields["gst"].value,5)) mo_item.generic = to_logical(form.INVEDATAMODULE1.INVE.rowset.fields["generic"].value) mo_item.hsn_code= form.invedatamodule1.inve.rowset.fields["hsn_code"].value else do select2.wfm endif else do select2.wfm endif if mo_item.recno >0 form.header.mod_cust.enabled = false class::add_item() else form.en_abled() form.footer.add.setfocus() endif endif return function DELETE_onClick() form.dis_able() mitem = alltrim(form.rowset.fields["company"].value) + " " +alltrim(form.rowset.fields["item"].value) + " " + alltrim(form.rowset.fields["descrip"].value) mch = msgbox(mitem , "Delete the following item",16+3+256) if mch = 6 if form.rowset.count()>1 or form.minvoice = form.last() recno = form.rowset.fields["mast"].value qty = form.rowset.fields["qty"].value mrow = form.rowset.fields["recno"].value cmd = 'delete from sales'+mcompany.fyear + ' where recno = '+ str(mrow,8,0) mcompany.adodb.executesql(cmd) if last_updated() >0 if mcompany.remote cmd = 'delete from sales'+mcompany.fyear + ' where rrecno = '+ str(mrow,8,0) endif mcompany.tr_log(cmd) form.update_inv(recno,qty*-1,form.mlocat) endif else msgbox("cannot delete the last item of the cash memo ") endif class::refresh_data() endif form.en_abled() form.header.mod_cust.enabled = true form.footer.add.setfocus() return function DISCARD_CUST_onClick() mch = msgbox("Discard the changes","Alert",64+4) if mch = 7 //do nothing else if mch = 6 form.header.mod_cust.text = "M&odify" form.header.ecaddr.enabled = false form.header.ecname.enabled = false form.header.mdate.enabled = false form.header.discard_cust.enabled = false form.mcust = form.rowset.fields["cname"].value form.maddr = form.rowset.fields["caddr"].value form.mdate = form.rowset.fields["ddate"].value form.header.ecname.value = form.mcust form.header.ecaddr.value = form.maddr form.header.mdate.assign_val(form.mdate) // form.header.mdate.value = dtoc(form.mdate) // form.header.mdate.date = form.mdate form.en_abled() form.footer.add.setfocus() endif endif return function DISC_DISCARD_onClick() form.con_disc.ef_disc.value = 0 form.en_abled() form.footer.add.setfocus() form.header.mod_cust.enabled = true return function DISC_SAVE_onClick() disc_save = true form.refresh_data() if form.rowset.count() = 0 or form.minvoice <=0 disc_save = false // there are no items in the cash memo hence do not save endif if disc_save if form.salesdatamodule1.disco.rowset.count() >0 //A discounted entry is there we are simply editing it // A discounted entry is there delete / alter it mrow = form.salesdatamodule1.disco.rowset.fields["recno"].value if abs(form.con_DISC.ef_disc.value) < 0.02 cmd = 'delete from sales'+mcompany.fyear + ' where recno = '+ str(mrow,8,0) mcompany.adodb.executesql(cmd) if last_updated() >0 if mcompany.remote cmd = 'delete from sales'+mcompany.fyear + ' where rrecno = '+ str(mrow,8,0) endif mcompany.tr_log(cmd) endif else mamt = form.con_DISC.ef_disc.value*-1 mtax = val(left(form.con_disc.disc_vat.value,5)) madtax = val(substr(form.con_disc.disc_vat.value,7,5)) mcgst = round(split(mamt,mtax + madtax)/2 , 2) mgoods = mamt - mcgst*2 cmd = [UPDATE sales]+mcompany.fyear + [ SET ] cmd+= [ rate = ] + str(form.con_DISC.ef_disc.value,10,2) cmd+= [ ,tax = ] +left(form.con_disc.disc_vat.value,5) cmd+= [ ,adtax = ]+ substr(form.con_disc.disc_vat.value,7,5) cmd+= [ ,hsn_code = ']+ escape_str(substr(form.con_disc.disc_vat.value,13,4))+['] cmd+= [ ,cgst = ]+str(mcgst,10,2) cmd+= [ ,sgst = ]+str(mcgst,10,2) cmd+= [ ,goods = ]+ str(mgoods,10,2) cmd+= [ ,username = '] +escape_str(mcompany.user)+ ['] cmd+= [ ,access = ] + str(mcompany.access , 2,0) cmd+= [ ,t_time = '] + getseconds()+['] cmd+= [ ,comp = ']+getenv('computername') + ['] cmd+=[ where recno = ]+ str(mrow,8,0) mcompany.adodb.executesql(cmd) if last_updated() >0 if mcompany.remote cmd = [UPDATE sales]+mcompany.fyear + [ SET ] cmd+= [ rate = ] + str(form.con_DISC.ef_disc.value,10,2) cmd+= [ ,tax = ] +left(form.con_disc.disc_vat.value,5) cmd+= [ ,adtax = ]+ substr(form.con_disc.disc_vat.value,7,5) cmd+= [ ,hsn_code = ']+ substr(form.con_disc.disc_vat.value,13,4)+['] cmd+= [ ,cgst = ]+str(mcgst,10,2) cmd+= [ ,sgst = ]+str(mcgst,10,2) cmd+= [ ,goods = ]+ str(mgoods,10,2) cmd+= [ ,username = '] + escape_str(mcompany.user)+ ['] cmd+= [ ,access = ] + str(mcompany.access , 2,0) cmd+= [ ,t_time = '] + getseconds()+['] cmd+= [ ,comp = ']+getenv('computername') + ['] cmd+=[ where rrecno = ]+ str(mrow,8,0) endif mcompany.tr_log(cmd) endif endif else if ABS(form.con_DISC.ef_disc.value) > 0.02 mamt = form.con_DISC.ef_disc.value * -1 mtax = val(left(form.con_disc.disc_vat.value,5)) madtax = val(substr(form.con_disc.disc_vat.value,7,5)) mcgst = round(split(mamt,mtax + madtax)/2,2) mgoods = mamt - mcgst*2 cmd = [INSERT INTO sales]+mcompany.fyear + [ (mast , company , item , descrip , comment , mrp , locat] cmd+=[ , disc , rate , qty , invoice_no , cname , caddr] cmd+=[ , ddate , unit , tax , adtax ] cmd+=[ , hsn_code , misc , sname , cgst ] cmd+=[ , sgst , goods , username ,access ] cmd+=[ , t_time , comp) ] cmd+= [ VALUES ( -1 , "Discount" , " " , " " , " " , 0 , "] +form.mlocat+ ["] cmd+= [, 0,]+ str(abs(mamt),10,2)+[ , -1 ,]+ str(form.minvoice,8,0)+ [, "]+escape_str(form.mcust)+[" , "]+escape_str(form.maddr)+["] cmd+= [ ,"]+dtos(form.header.mdate.date) + [" , " " , ]+str(mtax,5,2) +[,]+ str(madtax,5,2) cmd+= [ ,"] +substr(form.con_disc.disc_vat.value,13,4) + [",0 , " ",] + str(mcgst,9,2) cmd+= [ ,] + str(mcgst,9,2) + [,]+ str(mgoods,11,2) + [,"]+escape_str(mcompany.user)+[" , ] + str(mcompany.access,2,0) cmd+= [ ,"]+ getseconds()+ [","]+getenv('computername') +[")] mcompany.adodb.executesql(cmd) if mcompany.remote cmd = [INSERT INTO sales]+mcompany.fyear + [ (mast , company , item , descrip , comment , mrp , locat] cmd+=[ , disc , rate , qty , invoice_no , cname , caddr] cmd+=[ , ddate , unit , tax , adtax ] cmd+=[ , hsn_code , misc , sname , cgst ] cmd+=[ , sgst , goods , username ,access ] cmd+=[ , t_time , comp,rrecno) ] cmd+= [ VALUES ( -1 , "Discount" , " " , " " , " " , 0 , "] +form.mlocat+ ["] cmd+= [, 0,]+ str(abs(mamt),10,2)+[ , -1 ,]+ str(form.minvoice,8,0)+ [, "]+escape_str(form.mcust)+[" , "]+escape_str(form.maddr)+["] cmd+= [ ,"]+dtos(form.header.mdate.date) + [" , " " , ]+str(mtax,5,2) +[,]+ str(madtax,5,2) cmd+= [ ,"] +substr(form.con_disc.disc_vat.value,13,4) + [",0 , " ",] + str(mcgst,9,2) cmd+= [ ,] + str(mcgst,9,2) + [,]+ str(mgoods,11,2) + [,"]+mcompany.user +[" , ] + str(mcompany.access,2,0) cmd+= [ ,"]+ getseconds()+ [","]+getenv('computername') +[",]+last_insert_id()+[)] endif mcompany.tr_log(cmd) endif endif endif form.con_disc.ef_disc.value = 0 form.refresh_data() form.en_abled() form.footer.add.setfocus() form.header.mod_cust.enabled = true return function DISC_onClick() form.dis_able() form.refresh_data() mtax_slab = new array() mbook = form.rowset.bookmark() form.rowset.first() if form.rowset.count()>0 do while not (form.rowset.endofset) mtax = str(form.rowset.fields["tax"].value,5,2)+"+"+str(form.rowset.fields["adtax"].value,5,2)+" "+left(form.rowset.fields["hsn_code"].value,4) if mtax_slab.scan(mtax) = 0 mtax_slab.add(mtax) endif form.rowset.next() enddo endif form.rowset.goto(mbook) form.header.mod_cust.enabled = false form.con_disc.visible = true form.con_disc.enabled = true form.con_disc.disc_vat.datasource = 'array mtax_slab' *form.salesdatamodule1.disco.requery() if form.salesdatamodule1.disco.rowset.count() > 0 form.con_DISC.ef_disc.value = form.salesdatamodule1.disco.rowset.fields["rate"].value mtax = str(form.salesdatamodule1.disco.rowset.fields["tax"].value,5,2)+"+"+str(form.salesdatamodule1.disco.rowset.fields["adtax"].value,5,2)+; alltrim(form.salesdatamodule1.disco.rowset.fields["hsn_code"].value) if mtax_slab.scan(mtax) = 0 //do nothing value of tax slab will be automatically set to any one of the values else form.con_disc.disc_vat.value = mtax endif endif form.con_DISC.ef_disc.setfocus() return function DISC_when(bOpen) retval = false if form.rowset.count()>0 retval = true endif return retval function GOTO_onClick() form.minvoice = form.header.new_cashno.value form.refresh_data() form.footer.add.setfocus() return function ITEMDISCARD_onClick() additem::itemdiscard_onclick() form.header.mod_cust.enabled = true form.en_abled() form.footer.add.setfocus() return function MDESCRIP_onGotFocus() this.keyboard( "{End}" ) on key label uparrow up_arrow() return function MDISC_valid() if this.value <0 or this.value >100 retval = false else retval = true endif return retval function MLOCATS_onChange() do case case lower(this.value) = "head office" form.mlocat = "0" case this.value = alltrim(mcompany.go1) form.mlocat = "1" case this.value = alltrim(mcompany.go2) form.mlocat = "2" endcase form.refresh_data() form.footer.add.setfocus() return function MLOCATS_when(bOpen) retval = true if type('form.minvoice') <> "U" if form.minvoice>0 retval = false endif endif if mcompany.remote retval = false endif return retval function MODIFY_onClick() form.modi_item = new object() form.modi_item.recno = 0 form.modi_item.allow = true if (mcompany.access <3 AND form.rowset.fields["access"].value > mcompany.access) or (mcompany.access = 1 and mcompany.user <> alltrim(form.rowset.fields["username"].value)) msgbox("Sorry you cannot edit the item ") form.modi_item.allow = false endif if form.modi_item.allow form.dis_able() form.header.mod_cust.enabled = false form.modi_item.recno = form.rowset.fields["recno"].value //store values already stored in record to memory variable for later comparision. form.additem.enabled = true form.additem.visible = true form.additem.mcomp.value = form.rowset.fields["company"].value form.additem.mitem.value = form.rowset.fields["item"].value form.additem.mdescrip.value = form.rowset.fields["descrip"].value form.additem.mmrp.value = form.rowset.fields["mrp"].value form.additem.mdisc.value = form.rowset.fields["disc"].value form.additem.mrate.value = form.rowset.fields["rate"].value form.additem.mqty.value = form.rowset.fields["qty"].value form.additem.mmisc.value = form.rowset.fields["misc"].value form.additem.s_helper.value = form.rowset.fields["sname"].value form.additem.mrate.setfocus() form.additem.mcomment.value = form.rowset.fields["comment"].value form.modi_item.mast = form.rowset.fields["mast"].value form.modi_item.company = form.rowset.fields["company"].value form.modi_item.item = form.rowset.fields["item"].value form.modi_item.descrip = form.rowset.fields["descrip"].value form.modi_item.comment = form.rowset.fields["comment"].value form.modi_item.mrp = form.rowset.fields["mrp"].value form.modi_item.locat = form.rowset.fields["locat"].value form.modi_item.disc = form.rowset.fields["disc"].value form.modi_item.rate = form.rowset.fields["rate"].value form.modi_item.qty = form.rowset.fields["qty"].value form.modi_item.misc = form.rowset.fields["misc"].value form.modi_item.sname = form.rowset.fields["sname"].value form.modi_item.descrip = form.rowset.fields["descrip"].value form.modi_item.user = form.rowset.fields["username"].value form.modi_item.time = form.rowset.fields["t_time"].value form.modi_item.tax = form.rowset.fields["tax"].value form.modi_item.adtax = form.rowset.fields["adtax"].value form.additem.itemsave.onclick = form.fmodi_item endif return function MODIFY_when(bOpen) retval = false if mcompany.access >1 or mcompany.sdate = date() retval = true endif if type('form.minvoice')#'U' and form.minvoice < 1 and this.name # "ADD" retval = false endif return retval function MOD_CUST_onClick() if this.text = "M&odify" form.refresh_data() this.text = "&Save the changes" form.header.ecaddr.enabled = true form.header.ecname.enabled = true form.header.ecname.setfocus() if mcompany.access >1 form.header.mdate.enabled = true endif form.header.discard_cust.enabled = true form.dis_able() else mch = msgbox("Save the changes","Alert",64+3) if mch = 2 //do nothing else if mch = 6 cmd = [UPDATE sales]+mcompany.fyear + [ SET ] cmd+= [ cname = '] +escape_str(form.header.ecname.value) + ['] cmd+= [ ,caddr = '] +escape_str(form.header.ecaddr.value) + ['] cmd+= [ ,ddate = '] +dtos(form.header.mdate.date) + ['] cmd+=[ where invoice_no = ]+ str(form.minvoice,8,0) + [ AND locat = ']+form.mlocat + ['] mcompany.adodb.executesql(cmd) mcompany.tr_log(cmd) endif this.text = "M&odify" form.header.ecaddr.enabled = false form.header.ecname.enabled = false form.header.mdate.enabled = false form.header.discard_cust.enabled = false form.en_abled() form.footer.add.setfocus() endif endif return function refresh_data local mcount,mtotal , mdisco,bookmark numlock() mtime1 = seconds() m_curr_rec = form.rowset.fields["recno"].value form.salesdatamodule1.sales.params["invoice"].value = str(form.minvoice,10,0) form.salesdatamodule1.sales.params["location"].value = form.mlocat form.salesdatamodule1.sales.requery() mtime2 = seconds() form.salesdatamodule1.disco.params["invoice"].value = str(form.minvoice,10,0) form.salesdatamodule1.disco.params["location"].value = form.mlocat form.salesdatamodule1.disco.requery() mtime3 = seconds() mtotal = 0 mcount = 0 if form.rowset.count()>0 form.mcust = form.rowset.fields["cname"].value form.maddr = form.rowset.fields["caddr"].value form.mdate = form.rowset.fields["ddate"].value bookmark = null do while not (form.rowset.endofset) if form.rowset.fields["recno"].value = m_curr_rec bookmark = form.rowset.bookmark() endif mtotal += form.rowset.fields["qty"].value * form.rowset.fields["rate"].value - form.rowset.fields["misc"].value mcount+=form.rowset.fields["qty"].value form.rowset.next() enddo if bookmark # null form.rowset.goto(bookmark) else form.rowset.last() endif else if form.salesdatamodule1.disco.rowset.count() >0 cmd = "DELETE from sales"+mcompany.fyear cmd+=" where invoice_no = "+ str(form.minvoice,8,0) + " AND locat = '"+form.mlocat + "'" + " AND mast = -1" form.salesdatamodule1.disco.rowset.first() mcompany.adodb.executesql(cmd) mcompany.tr_log(cmd) form.salesdatamodule1.disco.requery() endif form.mdate = min(date(),mcompany.lyear) form.mdate = max(form.mdate , mcompany.byear) store space(30) to form.mcust , form.maddr form.minvoice = -1 endif form.header.ecname.value = form.mcust form.header.ecaddr.value = form.maddr form.header.cash_no.text = "Cash Memo No. "+ iif(form.minvoice = -1 , "new" , form.minvoice); + " " form.header.tdate.text = "Date" form.header.mdate.assign_val(form.mdate) form.subtotal.text = "Sub Total "+ str(mtotal,10,2) if form.salesdatamodule1.disco.rowset.count() >0 mdisco = form.salesdatamodule1.disco.rowset.fields["rate"].value form.disco.text = "Discount "+ str(mdisco*-1,10,2) else form.disco.text = " " mdisco = 0 endif form.gtotal.text = "Grand Total "+ str(mtotal-mdisco,10,2) form.total_qty.text = "Total Qty " + str(mcount,6,mcompany.dec) form.total_qty.text += chr(13) + "Total items " + str(form.rowset.count(),5,0) mtime4 = seconds() form.date_range() form.footer.add.setfocus() return function form_canClose() _app.e_sales = NULL form.rapid_dis() close procedure sales2.dmd close procedure inve.dmd close procedure mun_controls.cc if mcompany.narrow close procedure p_sales.rep else close procedure p2_sales.rep endif return true function form_onOpen() form.minvoice = -1 _app.e_sales = form // if mcompany.narrow set procedure to p_sales.rep additive // else set procedure to p2_sales.rep additive // endif // form.r = new p_salesreport() class::num_onopen() form.text = "Cash Memo Entry of "+ mcompany.company form.header.mlocats.dataSource = loc_combo() form.mlocat = "0" form.mdate = min(date(),mcompany.lyear) form.mdate = max(form.mdate,mcompany.byear) form.header.new_cashno.rangemax = form.last() store space(30) to form.mcust , form.maddr form.rowset.first() class::refresh_data() form.footer.add.setfocus() class::rapid_en() form.header.mdate.validErrormsg = "Please enter a date between "+dtoc(mcompany.byear) + ; " & " + dtoc(mcompany.lyear) form.header.mdate.rangemax = mcompany.lyear form.header.mdate.rangemin = mcompany.byear if mcompany.remote form.header.mlocats.value = location(mcompany.remote_loc) form.mlocat = mcompany.remote_loc endif return function fmodi_item() local bookmark form.salesdatamodule1.sales.requery() if form.rowset.count()>0 AND form.modi_item.recno >0 bookmark = null do while not (form.rowset.endofset) if form.rowset.fields["recno"].value = form.modi_item.recno bookmark = form.rowset.bookmark() endif form.rowset.next() enddo if bookmark # null if (form.additem.mqty.value = 0 OR empty(form.additem.mcomp.value)) AND form.rowset.count() =1 msgbox("Cannot delete last item of the cash memo ") else form.rowset.goto(bookmark) if form.additem.mqty.value <> 0 mamt = form.additem.mrate.value*form.additem.mqty.value - form.additem.mmisc.value mcgst = round(split(mamt,form.modi_item.tax +form.modi_item.adtax)/2 , 2) mgoods= mamt - mcgst*2 cmd = [UPDATE sales]+mcompany.fyear + [ SET ] cmd+= [ company = '] + escape_str(form.additem.mcomp.value)+ ['] cmd+= [ ,item = '] + escape_str(form.additem.mitem.value)+ ['] cmd+= [ ,descrip = '] + escape_str(form.additem.mdescrip.value)+ ['] cmd+= [ ,comment = '] + escape_str(iif( trim(form.additem.mcomment.value)="COMMENT",[ ],form.additem.mcomment.value))+ ['] cmd+= [ ,mrp = ] +str(form.additem.mmrp.value,11,2) cmd+= [ ,disc = ] +str(form.additem.mdisc.value,6,2) cmd+= [ ,rate = ] +str(form.additem.mrate.value,11,2) cmd+= [ ,qty = ] +str(form.additem.mqty.value,11,2) cmd+= [ ,misc = ] +str(form.additem.mmisc.value,11,2) cmd+= [ ,sname = '] +escape_str(form.additem.s_helper.value)+ ['] cmd+= [ ,cgst = ]+str(mcgst,10,2) cmd+= [ ,sgst = ]+str(mcgst,10,2) cmd+= [ ,goods = ]+ str(mgoods,10,2) cmd+= [ ,username = '] + escape_str(mcompany.user)+ ['] cmd+= [ ,access = ] + str(mcompany.access , 2,0) cmd+= [ ,t_time = '] + getseconds()+['] cmd+= [ ,comp = ']+escape_str(getenv('computername'))+ ['] cmd+=[ where recno = ]+ str(form.modi_item.recno,8,0) mcompany.adodb.executesql(cmd) if mcompany.remote cmd = [UPDATE sales]+mcompany.fyear + [ SET ] cmd+= [ company = '] + escape_str(form.additem.mcomp.value)+ ['] cmd+= [ ,item = '] + escape_str(form.additem.mitem.value)+ ['] cmd+= [ ,descrip = '] + escape_str(form.additem.mdescrip.value)+ ['] cmd+= [ ,comment = '] + escape_str(iif( trim(form.additem.mcomment.value)="COMMENT",[ ],form.additem.mcomment.value))+ ['] cmd+= [ ,mrp = ] +str(form.additem.mmrp.value,11,2) cmd+= [ ,disc = ] +str(form.additem.mdisc.value,6,2) cmd+= [ ,rate = ] +str(form.additem.mrate.value,11,2) cmd+= [ ,qty = ] +str(form.additem.mqty.value,11,2) cmd+= [ ,misc = ] +str(form.additem.mmisc.value,11,2) cmd+= [ ,sname = '] +escape_str(form.additem.s_helper.value)+ ['] cmd+= [ ,cgst = ]+str(mcgst,10,2) cmd+= [ ,sgst = ]+str(mcgst,10,2) cmd+= [ ,goods = ]+ str(mgoods,10,2) cmd+= [ ,username = '] + escape_str(mcompany.user)+ ['] cmd+= [ ,access = ] + str(mcompany.access , 2,0) cmd+= [ ,t_time = '] + getseconds()+['] cmd+= [ ,comp = ']+escape_str(getenv('computername'))+ ['] cmd+=[ where rrecno = ]+ str(form.modi_item.recno,8,0) endif mcompany.tr_log(cmd) else cmd = "delete from sales"+mcompany.fyear + " where recno = "+ str(form.modi_item.recno,8,0) mcompany.adodb.executesql(cmd) if mcompany.remote cmd = "delete from sales"+mcompany.fyear + " where rrecno = "+ str(form.modi_item.recno,8,0) endif mcompany.tr_log(cmd) endif form.update_inv(form.modi_item.mast , form.additem.mqty.value+form.modi_item.qty*-1 , form.mlocat ,"lsprice" ,form.additem.mrate.value ) endif else msgbox("Sorry the edited record has been deleted by someone else") endif form.modi_item = new object() form.additem.mcomp.value = " " form.additem.mitem.value = " " form.additem.mdescrip.value = " " form.additem.mmrp.value = 0 form.additem.mdisc.value = 0 form.additem.mrate.value = 0 form.additem.mqty.value = 0 form.additem.mmisc.value = 0 form.additem.enabled = false form.additem.visible = false class::refresh_data() form.en_abled() form.footer.add.setfocus() form.header.mod_cust.enabled = true form.additem.itemsave.onclick = form.save_item endif return function save_item() if not empty(form.additem.mcomp.value) and form.additem.mqty.value <>0 time1 = seconds() form.minvoice = iif(form.minvoice>0 , form.minvoice ,form.last()+1 ) mamt = form.additem.mrate.value*form.additem.mqty.value - form.additem.mmisc.value mcgst = round(split(mamt,mo_item.tax +mo_item.adtax)/2 , 2) mgoods= mamt - mcgst*2 temp = form.header.mdate.date cmd = [INSERT INTO sales]+mcompany.fyear + [ (mast , company , item , descrip , comment , mrp , locat] cmd+=[ , disc , rate , qty , invoice_no , cname , caddr] cmd+=[ , ddate , unit , tax , adtax ] cmd+=[ , hsn_code , misc , sname , cgst ] cmd+=[ , sgst , goods , username ,access ] cmd+=[ , t_time , comp) ] cmd+= [ VALUES ( ]+str(mo_item.recno,8,0)+[, "]+escape_str(form.additem.mcomp.value)+[" , "]+escape_str(form.additem.mitem.value)+[ " , "]+escape_str(form.additem.mdescrip.value)+[" , "]+escape_str(iif( trim(form.additem.mcomment.value)="COMMENT",[ ],form.additem.mcomment.value))+[" , ]+str(form.additem.mmrp.value,11,2)+[ , "] +form.mlocat+ ["] cmd+= [,]+str(form.additem.mdisc.value,11,2)+[,]+ str(form.additem.mrate.value,10,2)+[ ,]+ str(form.additem.mqty.value,8,mcompany.dec)+[,]+ str(form.minvoice,8,0)+ [, "]+escape_str(form.mcust)+[" , "]+escape_str(form.maddr)+["] cmd+= [ ,"]+dtos(form.header.mdate.date) + [" , "]+escape_str(mo_item.unit)+[" , ]+str(mo_item.tax,5,2) +[,]+ str(mo_item.adtax,5,2) cmd+= [ ,"] +escape_str(left(mo_item.hsn_code,4))+ [",]+str(form.additem.mmisc.value,11,2)+[ ,"]+escape_str(form.additem.s_helper.value)+[",] + str(mcgst,9,2) cmd+= [ ,] + str(mcgst,9,2) + [,]+ str(mgoods,11,2) + [,"]+escape_str(mcompany.user)+[" , ] + str(mcompany.access,2,0) cmd+= [ ,"]+ getseconds()+ [","]+escape_str(getenv('computername'))+[")] mcompany.adodb.executesql(cmd) if mcompany.remote cmd = [INSERT INTO sales]+mcompany.fyear + [ (mast , company , item , descrip , comment , mrp , locat] cmd+=[ , disc , rate , qty , invoice_no , cname , caddr] cmd+=[ , ddate , unit , tax , adtax ] cmd+=[ , hsn_code , misc , sname , cgst ] cmd+=[ , sgst , goods , username ,access ] cmd+=[ , t_time , comp,rrecno) ] cmd+= [ VALUES ( ]+str(mo_item.recno,8,0)+[, "]+escape_str(form.additem.mcomp.value)+[" , "]+escape_str(form.additem.mitem.value)+[ " , "]+escape_str(form.additem.mdescrip.value)+[" , "]+escape_str(iif( trim(form.additem.mcomment.value)="COMMENT",[ ],form.additem.mcomment.value))+[" , ]+str(form.additem.mmrp.value,11,2)+[ , "] +form.mlocat+ ["] cmd+= [,]+str(form.additem.mdisc.value,11,2)+[,]+ str(form.additem.mrate.value,10,2)+[ ,]+ str(form.additem.mqty.value,8,mcompany.dec)+[,]+ str(form.minvoice,8,0)+ [, "]+escape_str(form.mcust)+[" , "]+escape_str(form.maddr)+["] cmd+= [ ,"]+dtos(form.header.mdate.date) + [" , "]+escape_str(mo_item.unit)+[" , ]+str(mo_item.tax,5,2) +[,]+ str(mo_item.adtax,5,2) cmd+= [ ,"] +escape_str(left(mo_item.hsn_code,4))+ [",]+str(form.additem.mmisc.value,11,2)+[ ,"]+escape_str(form.additem.s_helper.value)+[",] + str(mcgst,9,2) cmd+= [ ,] + str(mcgst,9,2) + [,]+ str(mgoods,11,2) + [,"]+escape_str(mcompany.user)+[" , ] + str(mcompany.access,2,0) cmd+= [ ,"]+ getseconds() + [","]+escape_str(getenv('computername'))+[",]+last_insert_id()+[)] endif mcompany.tr_log(cmd) form.update_inv(mo_item.recno , form.additem.mqty.value , form.mlocat ,"lsprice" , form.additem.mrate.value) mo_item = new object() form.additem.mcomp.value = " " form.additem.mitem.value = " " form.additem.mdescrip.value= " " form.additem.mmrp.value = 0 form.additem.mdisc.value = 0 form.additem.mrate.value = 0 form.additem.mqty.value = 0 form.additem.mmisc.value = 0 form.additem.enabled = false form.additem.visible = false form.rowset.last() else *msgbox("Company name cannot remain blank, Unable to save") endif class::refresh_data() form.salesdatamodule1.sales.rowset.last() form.en_abled() form.footer.add.setfocus() form.header.mod_cust.enabled = true return function dis_able() form.footer.add.enabled = false form.footer.delete.enabled = false form.footer.modify.enabled = false form.footer.print.enabled = false form.footer.new.enabled = false form.header.goto.enabled = false form.header.new_cashno.enabled = false form.footer.disc.enabled = false form.rapid_dis() return true function en_abled() form.footer.add.enabled = true form.footer.delete.enabled = true form.footer.modify.enabled = true form.footer.print.enabled = true form.footer.new.enabled = true form.header.goto.enabled = true form.header.new_cashno.enabled = true form.footer.disc.enabled = true form.con_disc.enabled = false form.con_disc.visible = false form.additem.visible = false form.rapid_en() return true function NEW_CASHNO_onGotFocus() form.header.new_cashno.rangemax = form.last() form.rapid_dis() return function NEW_CASHNO_onLostFocus() form.rapid_en() return function NEW_onClick() form.minvoice = -1 form.refresh_data() return function PRINT_onClick() form.refresh_data() if not form.footer.half_page.value r = new p_salesreport() else r = new p2_salesreport() endif mrender = 0 r.salesdatamodule1.sales.params["invoice"].value = str(form.minvoice,10,0) r.salesdatamodule1.sales.params["location"].value = form.mlocat r.salesdatamodule1.sales.requery() r.salesdatamodule1.psale.params["invoice"].value = str(form.minvoice,10,0) r.salesdatamodule1.psale.params["location"].value = form.mlocat r.salesdatamodule1.psale.requery() r.salesdatamodule1.disco.params["invoice"].value = str(form.minvoice,10,0) r.salesdatamodule1.disco.params["location"].value = form.mlocat r.salesdatamodule1.disco.requery() r.title = "Cash memo no. "+str(form.minvoice,10,0) // if mcompany.narrow and not empty(mcompany.printer) if not form.footer.half_page.value load_ini("cashmemo.ini","r.printer") // msgbox("loaded ini") else load_ini("cashmemo_h.ini","r.printer") endif r.title = "Cash Memo no. "+form.minvoice r.render() // msgbox("printed ") // else // if r.printer.chooseprinter() // r.title = "Cash Memo no. "+form.minvoice // r.render() // endif // endif return function PRINT_when(bOpen) retval = false if form.rowset.count() >0 retval = true endif return retval function SALES_onGotFocus() form.rapid_dis() return function SALES_onLostFocus() if not form.additem.visible form.rapid_en() endif return function last() local mcount form.salesdatamodule1.last.params["location"].value = form.mlocat form.salesdatamodule1.last.requery() mcount = form.salesdatamodule1.last.rowset.fields["numb"].value if mcount = null mcount = 0 endif return mcount function rapid_en() if form.additem.visible = false on key label pgup _app.e_sales.plus1() on key label pgdn _app.e_sales.minus1() on key label home _app.e_sales.plus10() on key label end _app.e_sales.minus10() on key label esc _app.e_sales.refresh_data() form.invedatamodule1.rapid.rowset.first() r = form.invedatamodule1.rapid.rowset.fields do while not form.invedatamodule1.rapid.rowset.endofset if lower(r["key_st"].value) $ "0123456789./*-+qwertyuiop[]\asdfghjkl;'zxcvbnm,./`" cmd = "on key label "+r["key_st"].value +" _app.e_sales.add_onclick("+alltrim(str(r["recno"].value,6,0))+")" &cmd endif r.parent.next() enddo endif return function rapid_dis() on key return function plus1() form.rapid_dis() if form.header.mod_cust.enabled and form.footer.add.enabled mlast = form.last() do case case form.minvoice < mlast if form.minvoice >0 form.minvoice++ endif case form.minvoice = mlast form.minvoice = -1 endcase form.refresh_data() endif form.rapid_en() return function minus1() form.rapid_dis() if form.header.mod_cust.enabled and form.footer.add.enabled do case case form.minvoice >1 temp = form.minvoice - 1 form.minvoice = temp case form.minvoice = -1 mlast = form.last() form.minvoice := mlast endcase if form.minvoice = 0 form.minvoice := -1 endif form.refresh_data() endif form.rapid_en() return function plus10() form.rapid_dis() if form.header.mod_cust.enabled and form.footer.add.enabled mlast = form.last() if form.minvoice >0 form.minvoice = min(mlast , form.minvoice+10) endif form.refresh_data() endif form.rapid_en() return function minus10() form.rapid_dis() if form.header.mod_cust.enabled and form.footer.add.enabled do case case form.minvoice >1 form.minvoice = max(1, form.minvoice-10) case form.minvoice = -1 mlast = form.last() form.minvoice = mlast endcase if form.minvoice = 0 form.minvoice := -1 endif form.refresh_data() endif form.rapid_en() return function date_range() form.salesdatamodule1.date_r.params["inv_fr"].value = str(form.minvoice-1,10,0) form.salesdatamodule1.date_r.params["inv_to"].value = str(form.minvoice+1,10,0) form.salesdatamodule1.date_r.params["location"].value = form.mlocat form.salesdatamodule1.date_r.requery() form.header.mdate.rangemax = mcompany.lyear form.header.mdate.rangemin = mcompany.byear do while not form.salesdatamodule1.date_r.rowset.endofset if form.salesdatamodule1.date_r.rowset.fields["invoice_no"].value < form.minvoice form.header.mdate.rangemin = form.salesdatamodule1.date_r.rowset.fields["ddate"].value endif if form.salesdatamodule1.date_r.rowset.fields["invoice_no"].value > form.minvoice form.header.mdate.rangemax = form.salesdatamodule1.date_r.rowset.fields["ddate"].value endif form.salesdatamodule1.date_r.rowset.next() enddo form.header.mdate.validErrormsg = "Please enter a date between "+dtoc(form.header.mdate.rangemin) + ; " & " + dtoc(form.header.mdate.rangemax) return endclass