0
SELECT
si.order_id AS 'ORDER NUMBER',
so.created_at 'ORDER DATE',
si.created_at AS 'INVOICE DATE',
so.customer_email,
so.grand_total,
IF(
    _payment.method = 'checkmo',
    'BANK CHECK',
    IF(
        _payment.method = 'banktransfer',
        'WIRE PAYMENT',
        IF(
            _payment.method = 'cash',
            'CASH',
            IF(
                _payment.method = 'gateway',
                'CREDIT CARD',
                NULL
            )
        )
    )
) AS 'PAYMENT METHOD'

FROM sales_invoice si JOIN sales_order so ON si.order_id = so.entity_id JOIN sales_order_payment _payment ON so.entity_id = _payment.parent_id WHERE si.created_at BETWEEN '2022-03-01' AND '2022-04-01'

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.