Subversion Repositories SmartDukaan

Rev

Rev 18698 | Rev 18756 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 18698 Rev 18755
Line 3055... Line 3055...
3055
            
3055
            
3056
            if order.transaction.payment_option == capitalFloatPayMethod:
3056
            if order.transaction.payment_option == capitalFloatPayMethod:
3057
                total_amount = 0
3057
                total_amount = 0
3058
                for ordObj in grouppedOrdersList:
3058
                for ordObj in grouppedOrdersList:
3059
                    total_amount = total_amount + ordObj.total_amount + ordObj.shippingCost - ordObj.gvAmount
3059
                    total_amount = total_amount + ordObj.total_amount + ordObj.shippingCost - ordObj.gvAmount
3060
                if not order.delivery_timestamp:
-
 
3061
                    creditObj = __creditHistoryObj(order.customer_id, 1, order.transaction.id, total_amount, CreditTxnType.BLOCK_REVERSED, order.logisticsTransactionId)
-
 
3062
                    creditTxns = []
-
 
3063
                    creditTxns.append(creditObj)
-
 
3064
                    try:
-
 
3065
                        process_credit_transaction(order.transaction.id, order.customer_id, 1, creditTxns)
-
 
3066
                    except:
-
 
3067
                        traceback.print_exc()
-
 
3068
                        session.rollback()
-
 
3069
                        return False
-
 
3070
                else:
3060
                
3071
                    loanObj = __loanHistoryObj(order.customer_id, 1, order.transaction.id, total_amount, CreditTxnType.CORRECTION, order.logisticsTransactionId)
3061
                creditObj = __creditHistoryObj(order.customer_id, 1, order.transaction.id, total_amount, CreditTxnType.BLOCK_REVERSED, order.logisticsTransactionId)
3072
                    loanTxns = []
3062
                creditTxns = []
3073
                    loanTxns.append(loanObj)
3063
                creditTxns.append(creditObj)
3074
                    try:
3064
                try:
3075
                        process_loan_transaction(order.transaction.id, order.customer_id, 1, loanTxns)
3065
                    process_credit_transaction(order.transaction.id, order.customer_id, 1, creditTxns)
3076
                    except:
3066
                except:
3077
                        traceback.print_exc()
3067
                    traceback.print_exc()
3078
                        session.rollback()
3068
                    session.rollback()
3079
                        return False
3069
                    return False
3080
                
3070
                
3081
            for orderObj in grouppedOrdersList:
3071
            for orderObj in grouppedOrdersList:
3082
                if scanMap.has_key(orderObj.status):
3072
                if scanMap.has_key(orderObj.status):
3083
                    scanType = scanMap[orderObj.status]
3073
                    scanType = scanMap[orderObj.status]
3084
                    lineitem = orderObj.lineitems[0]
3074
                    lineitem = orderObj.lineitems[0]
Line 8896... Line 8886...
8896
    new_order.lineitems[0].quantity = split_order_quantity
8886
    new_order.lineitems[0].quantity = split_order_quantity
8897
    new_order.lineitems[0].total_price = new_order.lineitems[0].unit_price*split_order_quantity
8887
    new_order.lineitems[0].total_price = new_order.lineitems[0].unit_price*split_order_quantity
8898
    new_order.lineitems[0].total_weight = new_order.lineitems[0].unit_weight*split_order_quantity
8888
    new_order.lineitems[0].total_weight = new_order.lineitems[0].unit_weight*split_order_quantity
8899
    new_order.total_amount = new_order.lineitems[0].total_price
8889
    new_order.total_amount = new_order.lineitems[0].total_price
8900
    new_order.total_weight = new_order.lineitems[0].total_weight
8890
    new_order.total_weight = new_order.lineitems[0].total_weight
-
 
8891
    new_order.
8901
    new_order.shippingCost = round((order.shippingCost/order.lineitems[0].quantity)*split_order_quantity,0)
8892
    new_order.shippingCost = round((order.shippingCost/order.lineitems[0].quantity)*split_order_quantity,0)
8902
    
8893
    
8903
    order.lineitems[0].quantity = order.lineitems[0].quantity - split_order_quantity
8894
    order.lineitems[0].quantity = order.lineitems[0].quantity - split_order_quantity
8904
    order.lineitems[0].total_price = order.lineitems[0].unit_price * order.lineitems[0].quantity
8895
    order.lineitems[0].total_price = order.lineitems[0].unit_price * order.lineitems[0].quantity
8905
    order.lineitems[0].total_weight = order.lineitems[0].unit_weight*order.lineitems[0].quantity
8896
    order.lineitems[0].total_weight = order.lineitems[0].unit_weight*order.lineitems[0].quantity
Line 9258... Line 9249...
9258
                        fetchCreditorDueDateMap()
9249
                        fetchCreditorDueDateMap()
9259
                        due_days = creditorDueDateMap.get(creditorId)
9250
                        due_days = creditorDueDateMap.get(creditorId)
9260
                        loanHistoryRec.due_date = datetime.datetime.now()+timedelta(days=due_days)
9251
                        loanHistoryRec.due_date = datetime.datetime.now()+timedelta(days=due_days)
9261
                if loanTxn.credit_type in [CreditTxnType.CORRECTION]:
9252
                if loanTxn.credit_type in [CreditTxnType.CORRECTION]:
9262
                    loanRec = LoanHistory.get_by(payment_id=paymentId,loan_id=loanTxn.loan_id, credit_type='LOAN')
9253
                    loanRec = LoanHistory.get_by(payment_id=paymentId,loan_id=loanTxn.loan_id, credit_type='LOAN')
9263
                    loanRec.updated = datetime.datetime.now()
-
 
9264
                    userSanction.loan = userSanction.loan + (loanTxn.amount * loanTxnMultplierMap.get(loanTxn.credit_type))
9254
                    userSanction.loan = userSanction.loan + (loanTxn.amount * loanTxnMultplierMap.get(loanTxn.credit_type))
9265
            else:
9255
            else:
9266
                logging.info("Error: Entry already existed for "+str(paymentId) + " Loan Id:- "+str(loanTxn.loan_id) +" Loan Txn Type:- "+CreditTxnType._VALUES_TO_NAMES[loanTxn.credit_type])
9256
                logging.info("Error: Entry already existed for "+str(paymentId) + " Loan Id:- "+str(loanTxn.loan_id) +" Loan Txn Type:- "+CreditTxnType._VALUES_TO_NAMES[loanTxn.credit_type])
9267
                raise TransactionServiceException(227, "Error: Entry already existed for "+str(paymentId) + " Loan Id:- "+str(loanTxn.loan_id) +" Loan Txn Type:- "+CreditTxnType._VALUES_TO_NAMES[loanTxn.credit_type])
9257
                raise TransactionServiceException(227, "Error: Entry already existed for "+str(paymentId) + " Loan Id:- "+str(loanTxn.loan_id) +" Loan Txn Type:- "+CreditTxnType._VALUES_TO_NAMES[loanTxn.credit_type])
9268
    session.commit()   
9258
    session.commit()