import { ApiHelper } from '/js/util/api.js';

export const ReportDataService = {
    //輔具出租記錄
    GetRentalList: async function (queryData) {
        return await ApiHelper.sendRequest('/api/Report/GetRentalList', "POST", queryData);
    },
    ExportRentalList: async function (exportData) {
        return await ApiHelper.sendRequest('/api/Report/ExportRentalList', "POST", exportData);
    },
    //輔具清消維修記錄
    GetRepairHistory: async function (queryData) {
        return await ApiHelper.sendRequest('/api/Report/GetRepairHistory', "POST", queryData);
    },
    ExportStock: async function (exportData) {
        return await ApiHelper.sendRequest('/api/Report/ExportStock', "POST", exportData);
    },
    //輔具清消維修統計
    GetMaintenance: async function (queryData) {
        return await ApiHelper.sendRequest('/api/Report/GetMaintenance', "POST", queryData);
    },
    ExportMaintenance: async function (queryData) {
        return await ApiHelper.sendRequest('/api/Report/ExportMaintenance', "POST", queryData);
    },
    //租轉售記錄
    GetRentToSale: async function (queryData) {
        return await ApiHelper.sendRequest('/api/Report/GetRentToSale', "POST", queryData);
    },
    ExportRentToSale: async function (exportData) {
        return await ApiHelper.sendRequest('/api/Report/ExportRentToSale', "POST", exportData);
    },
    //門市對帳報表
    GetMarket: async function () {
        var res = (await ApiHelper.sendRequest('/api/Report/GetMarket', "GET")).data;
        res.forEach(function (item) {
            if (item.status == 0) {
                item.name = item.name + " (停用)";
            }
        });
        return res;
    },
    GetStoreRental: async function (queryData) {
        return await ApiHelper.sendRequest('/api/Report/GetStoreRental', "POST", queryData);
    },
    GetStoreFreightage: async function (queryData) {
        return await ApiHelper.sendRequest('/api/Report/GetStoreFreightage', "POST", queryData);
    },
    GetStoreRepairing: async function (queryData) {
        return await ApiHelper.sendRequest('/api/Report/GetStoreRepairing', "POST", queryData);
    },
    GetStoreConsumableFee: async function (queryData) {
        return await ApiHelper.sendRequest('/api/Report/GetStoreConsumableFee', "POST", queryData);
    },
    GetStoreTransfer: async function (queryData) {
        return await ApiHelper.sendRequest('/api/Report/GetStoreTransfer', "POST", queryData);
    },
    GetStoreRentalInvoice: async function (queryData) {
        return await ApiHelper.sendRequest('/api/Report/GetStoreRentalInvoice', "POST", queryData);
    },
    GetStoreAdditionInvoice: async function (queryData) {
        return await ApiHelper.sendRequest('/api/Report/GetStoreAdditionInvoice', "POST", queryData);
    },
    GetStoreFreightageInvoice: async function (queryData) {
        return await ApiHelper.sendRequest('/api/Report/GetStoreFreightageInvoice', "POST", queryData);
    },
    GetStoreRepairingInvoice: async function (queryData) {
        return await ApiHelper.sendRequest('/api/Report/GetStoreRepairingInvoice', "POST", queryData);
    },
    GetStoreConsumableFeeInvoice: async function (queryData) {
        return await ApiHelper.sendRequest('/api/Report/GetStoreConsumableFeeInvoice', "POST", queryData);
    },
    UpdateVerified: async function (data) {
        return await ApiHelper.sendRequest('/api/Report/UpdateVerified', 'PATCH', data);
    },
    RestoreVerified: async function (data) {
        return await ApiHelper.sendRequest('/api/Report/RestoreVerified', 'PATCH', data);
    },
    ExportStoreBill: async function (exportData) {
        return await ApiHelper.sendRequest('/api/Report/ExportStoreBill', "POST", exportData);
    },
    //直客對帳報表
    GetUserList: async function (queryData) {
        return await ApiHelper.sendRequest('/api/Report/GetUserList', "POST", queryData);
    },
    GetUserOrderList: async function (queryData) {
        return await ApiHelper.sendRequest('/api/Report/GetUserOrderList', "POST", queryData);
    },
    GetUserOrderSummary: async function (queryData) {
        return await ApiHelper.sendRequest('/api/Report/GetUserOrderSummary', "POST", queryData);
    },
    GetUserOrders: async function (orderNum) {
        return await ApiHelper.sendRequest(`/api/Report/GetUserOrders?orderNum=${orderNum}`, "GET");
    },
    //營業報表
    GetOperatingRental: async function (queryData) {
        return await ApiHelper.sendRequest('/api/Report/GetOperatingRental', "POST", queryData);
    },
    ExportOperatingRental: async function (exportData) {
        return await ApiHelper.sendRequest('/api/Report/ExportOperatingRental', "POST", exportData);
    },
    //銷售報表
    GetSaleOrders: async function (queryData) {
        return await ApiHelper.sendRequest('/api/Report/GetSaleOrders', "POST", queryData);
    },
    UpdateSaleOrdersVerified: async function (data) {
        return await ApiHelper.sendRequest('/api/Report/UpdateSaleOrdersVerified', 'PATCH', data);
    },
    RestoreSaleOrdersVerified: async function (data) {
        return await ApiHelper.sendRequest('/api/Report/RestoreSaleOrdersVerified', 'PATCH', data);
    },
    ExportSaleOrdersBill: async function (exportData) {
        return await ApiHelper.sendRequest('/api/Report/ExportSaleOrdersBill', "POST", exportData);
    }
}