def add_supplier_payment_detail(buy_id, supplier_id, paid, unpaid, payment_method, is_return=False, note=''): payment = Payment() payment.buy_id(buy_id) payment.supplier_id(supplier_id) payment.payment_method(payment_method) payment.paid(paid) payment.unpaid(unpaid) payment.create_op(common.config.login_user_info[0]) payment.create_time(time_utils.get_now()) payment.note(note) if is_return: payment.refund_type(Payment.returned()) else: payment.refund_type(Payment.payoff()) payment_handler.add_payment_detail(payment) if unpaid: supplier_handler.update_supplier_unpaid(supplier_id, unpaid)
def add_payment_detail(payment: Payment): sql_text = ''' INSERT INTO PAYMENT_DETAIL( BUY_ID, PAYMENT_METHOD, PAID, UNPAID, CREATE_TIME, CREATE_OP, refund_type, supplier_id, note ) VALUES ( {}, {}, {:.2f}, {:.2f}, '{}', {}, {}, {}, '{}' )''' \ .format(payment.buy_id(), payment.payment_method(), payment.paid(), payment.unpaid(), get_now(), common.config.login_user_info[0], payment.refund_type(), payment.supplier_id(), payment.note()) result = execute(sql_text) return result
def _add_payment_detail(self, paid: float, unpaid: float, ): payment = Payment() payment.buy_id(self.buy_id) payment_method = int(self.payment_method.currentData()) payment.payment_method(payment_method) payment.paid(paid) payment.unpaid(unpaid) payment.create_op(Common.config.login_user_info[0]) payment.create_time(time_utils.get_now()) payment.refund_type(Payment.payoff()) payment_handler.add_payment_detail(payment)