Exemple #1
0
 def test_getall(self):
     for ii in range(1,10):
         posts = ['KASIR','PENJUALAN','BELANJA']
         record = Record(date=datetime.date.today(),accountingId=str(randomId()),accountingPost=posts[ii %3],accountingType='KREDIT',notes='Test'+str(randomId()),amount=randomId())
         recordAccessor.addRecord(record)
     records = recordAccessor.getAllRecords('KASIR')
     assert(records!=None)
Exemple #2
0
 def test_add(self):
     record = Record(date=datetime.date.today(),accountingId=str(randomId()),accountingPost='KASIR',accountingType='KREDIT',notes='Test'+str(randomId()),amount=randomId())
     recordAccessor.addRecord(record)
     result = recordAccessor.getRecordById(record.accountingId)
     assert(not result == None)
     del(result)
     result = recordAccessor.getRecordById(record.accountingId)
     result.amount = 4000
     recordAccessor.updateRecord(result)
Exemple #3
0
def addRecord():
    json = request.get_json()
    data = json['data']
    postType = json['postType']
    record = Record()
    record.date = datetime.datetime.fromtimestamp(data['time'] / 1000.0)
    record.accountingType = data['accountingType']
    record.notes = data['notes']
    record.amount = data['amount']
    record.accountingPost = data['accountingPost']
    record.accountingId = str(randomId())
    recordAccessor.addRecord(record)
    return jsonify(dict(postType=postType))
Exemple #4
0
def addRecord():
    json = request.get_json()
    data = json['data']
    postType = json['postType']
    record = Record()
    record.date = datetime.datetime.fromtimestamp(data['time']/1000.0)
    record.accountingType = data['accountingType']
    record.notes = data['notes']
    record.amount = data['amount']
    record.accountingPost = data['accountingPost']
    record.accountingId = str(randomId())
    recordAccessor.addRecord(record)
    return jsonify(dict(postType=postType))