Esempio n. 1
0
    def withdrawalTransactionUpdate(tran_date, acc_number, amount, tranref):
        #   1. withdrawal detail between customer and till
        customer = session.query(Customer).filter_by(
            acc_number=acc_number).one()
        till_detail = session.query(Till).filter_by(
            till_account=Getters.getTillDetails().till_account).first()
        cb = float(customer.working_bal) - float(amount)
        trans = Transactions(trantype='DR',
                             tranref=tranref,
                             tranmethod='Cash',
                             tran_date=tran_date,
                             cheque_num='None',
                             acc_number=int(acc_number),
                             cr_acc_number=int(till_detail.till_account),
                             amount=amount,
                             current_balance=round(cb, 2),
                             remark='Withdrawal ' + tranref,
                             custid=customer.custid)
        session.add(trans)
        session.commit()
        # update customer working balance
        customer.working_bal = round(cb, 2)
        session.add(customer)
        session.commit()
        # -------------------------------
        # Update Till Opening/Closing balance
        till_detail.c_balance += round(amount, 2)
        session.add(till_detail)
        session.commit()
        # -------------------------------

        # 2. charge details between customer and charge account
        charge_account = session.query(Customer).filter_by(
            account_type='charges').first()
        get_charge = session.query(TransactionCharge).filter_by(
            tran_type='DR').first()
        cb2 = float(customer.working_bal) - float(get_charge.tran_charge)
        trans2 = Transactions(trantype='DR',
                              tranref=Auto.reference_string_generator(),
                              tranmethod='Charge Transfer',
                              tran_date=tran_date,
                              cheque_num='None',
                              acc_number=int(acc_number),
                              cr_acc_number=int(charge_account.acc_number),
                              amount=float(get_charge.tran_charge),
                              current_balance=round(cb2, 2),
                              remark='Debit Charge',
                              custid=customer.custid)
        session.add(trans2)
        session.commit()

        # Update Working balance on charge
        customer.working_bal = round(cb2, 2)
        session.add(customer)
        session.commit()
Esempio n. 2
0
    def eomServfeeTransactionUpdate(acc_number, tran_date, amount):
        charged_customer = session.query(Customer).filter_by(
            acc_number=acc_number).first()
        current_balance = charged_customer.working_bal - amount

        servfee = session.query(Customer).filter_by(
            account_type='servfee').first()
        # same transactiion reference for customer and suspense account
        tranref = Auto.reference_string_generator()
        # transaction for Charged Customer
        trans = Transactions(trantype='SF',
                             tranref=tranref,
                             tranmethod='COB',
                             tran_date=tran_date,
                             cheque_num='None',
                             acc_number=acc_number,
                             cr_acc_number=servfee.acc_number,
                             amount=amount,
                             current_balance=round(current_balance, 2),
                             remark='SERVFEES',
                             custid=charged_customer.custid)
        session.add(trans)
        session.commit()

        # update customer working balance
        charged_customer.working_bal = round(current_balance, 2)
        session.add(charged_customer)
        session.commit()
        # -------------------------------

        # transaction for Suspense account
        cb = servfee.working_bal + amount
        trans_sus = Transactions(trantype='SF',
                                 tranref=tranref,
                                 tranmethod='COB',
                                 tran_date=tran_date,
                                 cheque_num='None',
                                 acc_number=acc_number,
                                 cr_acc_number=servfee.acc_number,
                                 amount=amount,
                                 current_balance=round(cb, 2),
                                 remark='SERVFEES',
                                 custid=servfee.custid)

        session.add(trans_sus)
        session.commit()

        # update Suspence account Working balance
        servfee.working_bal = cb
        session.add(servfee)
        session.commit()
        # ---------------------------------------

        pass
Esempio n. 3
0
    def depositTransactionUpdate(tran_date, acc_number, amount, tranref):
        customer = session.query(Customer).filter_by(
            acc_number=acc_number).one()
        current_balance = float(amount) + float(customer.working_bal)

        till_detail = session.query(Till).filter_by(
            till_account=Getters.getTillDetails().till_account).first()
        trans = Transactions(trantype='CR',
                             tranref=Auto.reference_string_generator(),
                             tranmethod='Cash',
                             tran_date=tran_date,
                             cheque_num='None',
                             acc_number=int(till_detail.till_account),
                             cr_acc_number=int(acc_number),
                             amount=amount,
                             current_balance=round(current_balance, 2),
                             remark='Deposit ' + tranref,
                             custid=customer.custid)
        session.add(trans)
        session.commit()
        # Update customer working balance
        customer.working_bal = round(current_balance, 2)
        session.add(customer)
        session.commit()
        # -------------------------------

        # Update Till Opening/Closing   Balance
        till_detail.c_balance -= round(float(amount), 2)
        session.add(till_detail)
        session.commit()
        # ---------------------------
        pass
Esempio n. 4
0
    def accCreationCash(date, amount, acc_num):
        # establish the account for account creation
        acc_creation_sus_acc = session.query(Customer).filter_by(
            account_type='acccreate').first()

        cus = session.query(Customer).filter_by(acc_number=acc_num).one()
        # Update transactions Table
        trans = Transactions(trantype='CR',
                             tranref=Auto.reference_string_generator(),
                             tranmethod='Cash',
                             tran_date=date,
                             cheque_num='None',
                             acc_number=acc_creation_sus_acc.acc_number,
                             cr_acc_number=acc_num,
                             amount=amount,
                             current_balance=round(amount, 2),
                             remark='Account Creation',
                             custid=cus.custid)
        session.add(trans)
        session.commit()

        # update the Account creation Suspanse Account
        acc_creation_sus_acc.working_bal -= amount
        session.add(acc_creation_sus_acc)
        session.commit()
        # ---------------------------------------------

        pass
Esempio n. 5
0
    def deposit(self):
        account_creation_current_balance = round(self.amount, 2)

        transaction = Transactions(
            trantype='CR',
            tranref=Auto.reference_string_generator(),
            tranmethod='Cash',
            tran_date=self.date,
            cheque_num='None',
            acc_number=self._suspence_account.acc_number,
            cr_acc_number=self.acc_number,
            amount=self.amount,
            current_balance=round(self.amount, 2),
            remark='Account Creation',
            custid=self._customer_account.custid)
        session.add(transaction)
        session.commit()
Esempio n. 6
0
    def accInterestUpdate(cr_acc, total_amount, cb, cust_id):
        dr_acc_record = session.query(Customer).filter_by(
            account_type='interest').first()
        trans2 = Transactions(
            trantype='CR',
            tranref=Auto.reference_string_generator(),
            tranmethod='Interest',
            tran_date=Getters.getSysDate().date,
            cheque_num='None',
            acc_number=int(dr_acc_record.acc_number),  # interest account
            cr_acc_number=cr_acc,  # Client account
            amount=float(total_amount),
            current_balance=round(cb, 2),
            remark='Interest',
            custid=cust_id)

        session.add(trans2)
        session.commit()
        pass
Esempio n. 7
0
    def externalTransferTransactionUpdate(from_acc, to_acc, amount, remark,
                                          tran_date):
        f_customer = Getters.getCustomerAccountDetails(from_acc)
        current_balance = f_customer.working_bal - float(amount)
        # same transaction reference between from account and suspence account
        tranref = Auto.reference_string_generator()
        # transaction for a from customer
        trans = Transactions(trantype='RTGS',
                             tranref=tranref,
                             tranmethod='Transfer',
                             tran_date=tran_date,
                             cheque_num='None',
                             acc_number=from_acc,
                             cr_acc_number=to_acc,
                             amount=amount,
                             current_balance=round(current_balance, 2),
                             remark='RTGS ' + remark,
                             custid=f_customer.custid)

        session.add(trans)
        session.commit()

        # update from account working balance
        f_customer.working_bal = round(current_balance, 2)
        session.add(f_customer)
        session.commit()
        # -----------------------------------
        # updating RTGS Suspense Account Working balance
        to_suspense = session.query(Customer).filter_by(
            account_type='rtgs').first()
        to_suspense.working_bal += round(amount, 2)
        session.add(to_suspense)
        session.commit()
        # -----------------------------------
        # transaction for the Suspense Account
        trans_to = Transactions(trantype='RTGS',
                                tranref=tranref,
                                tranmethod='Transfer',
                                tran_date=tran_date,
                                cheque_num='None',
                                acc_number=from_acc,
                                cr_acc_number=to_acc,
                                amount=amount,
                                current_balance=round(to_suspense.working_bal,
                                                      2),
                                remark='RTGS ' + remark,
                                custid=to_suspense.custid)
        session.add(trans_to)
        session.commit()
        # charge details between customer and charge account

        charge_account = session.query(Customer).filter_by(
            account_type='charges').first()
        get_charge = session.query(TransactionCharge).filter_by(
            tran_type='RTGS').first()
        cb2 = float(f_customer.working_bal) - float(get_charge.tran_charge)
        trans2 = Transactions(trantype='DR',
                              tranref=Auto.reference_string_generator(),
                              tranmethod='Charge RTGS',
                              tran_date=tran_date,
                              cheque_num='None',
                              acc_number=int(from_acc),
                              cr_acc_number=int(charge_account.acc_number),
                              amount=float(get_charge.tran_charge),
                              current_balance=round(cb2, 2),
                              remark='RTGS Charge',
                              custid=f_customer.custid)
        session.add(trans2)
        session.commit()

        # update working balance of From Account after Charge effected
        f_customer.working_bal = round(cb2, 2)
        session.add(f_customer)
        session.commit()
        # -----------------------------------------------------------
        pass