def CreateProjectAccSequence(self,prefix): sequence = '' customid = customidgenAPI.custom_idgen(self.Config) customid.PrepareGetID('PROJECTACCOUNT', prefix) try: id = customid.GetLastID() sequence = str(id).zfill(4) customid.Commit() except: customid.Cancel() raise '', str(sys.exc_info()[1]) return sequence
def OnCreate(self, EmployeeId): Investment.OnCreate(self) # Generate Id Investment BranchCode = self.Config.SecurityContext.GetUserInfo()[4] prefix = 'INVEST.EMP.%s' % BranchCode customid = customidgenAPI.custom_idgen(self.Config) customid.PrepareGetID('INVESTMENT', prefix) try: id = customid.GetLastID() sequence = str(id).zfill(5) customid.Commit() except: customid.Cancel() raise '', str(sys.exc_info()[1]) self.AccountNo = '%s.%s' % (prefix , sequence) self.EmployeeId = EmployeeId
def GenerateInvoiceNo(config,helper): RomanDigit = { 1 : 'I', 2 : 'II', 3 : 'III', 4 : 'IV', 5 : 'V', 6 : 'VI', 7 : 'VII', 8 : 'VIII', 9 : 'IX', 10 : 'X', 11 : 'XI', 12 : 'XII', } # Prepare Code BranchCode = config.SecurityContext.GetUserInfo()[4] oBranch = helper.GetObject('Branch',BranchCode) ShortCode = oBranch.ShortCode Year,Month = config.ModLibUtils.DecodeDate(config.Now())[:2] # Generate sequence code config.BeginTransaction() try: customid = customidgenAPI.custom_idgen(config) IdCode = '%s-%s' % (ShortCode,Year) customid.PrepareGetID('INVOICE', IdCode) try: id = customid.GetLastID() SequenceNo = str(id) customid.Commit() except: customid.Cancel() raise '', str(sys.exc_info()[1]) config.Commit() except: config.Rollback() raise param = { 'ShortCode' : ShortCode, 'RomanDigit' : RomanDigit[Month], 'SequenceNo' : SequenceNo, 'Year' : str(Year), } return 'PKPU-%(ShortCode)s/%(RomanDigit)s.%(SequenceNo)s/E/%(Year)s'% param