public int create_invoice(cls_POSTransaction trans) { string datetime_d = trans.getdatetime().ToString("yyyy-MM-dd HH:mm:ss"); string branchid = cls_globalvariables.BranchCode; string terminalno = cls_globalvariables.terminalno_v; long userwid = trans.getclerk().getsyncid(); long next_ornumber = get_nextornumber(); long next_SyncId = GetAndInsertNextSyncId("saleshead"); string sSQL = @"UPDATE `saleshead` SET `branchid` = '" + branchid + @"', `date` = '" + datetime_d + @"', `userid` = '" + userwid + @"', `lastmodifiedby` = '" + userwid + @"', `lastmodifieddate` = NOW(), `datecreated` = NOW(), `ornumber` = '" + next_ornumber + @"', `terminalno` = '" + terminalno + @"' WHERE `SyncId` = '" + next_SyncId + @"'"; setdb(sSQL); trans.setORnumber(next_ornumber); trans.setSyncId(next_SyncId); return(0); }