starter.factory('Pay', function ($resource, cfg, formatFilter, Tool, showPopup) {
    var pay = {};

    pay.typeList = [];
    pay.typeItem = {};
    pay.recordItem = {};
    pay.recordList = [];
    pay.detailItem = {};
    pay.auditstepdata = [];
    pay.personstepdata = [];

    pay.type = $resource(formatFilter('{0}pay/type/:id/', cfg.api), {}, {'get': {method: 'GET', isArray: true}, 'patch': {method: 'PATCH', isArray: true}});
    pay.record = $resource(formatFilter('{0}pay/record/:id/', cfg.api));
    pay.recordfile = $resource(formatFilter('{0}pay/recordfile/:id/', cfg.api));
    pay.auditstep = $resource(formatFilter('{0}pay/auditstep/:id/', cfg.api), {}, {'save': {method: 'POST', isArray: true}, 'get': {method: 'GET', isArray: true}});
    pay.bill = $resource(formatFilter('{0}pay/bill/', cfg.api));
    pay.billdetail = $resource(formatFilter('{0}pay/billdetail/:id/', cfg.api));
    pay.stepcopy = $resource(formatFilter('{0}pay/stepcopy/:id/', cfg.api));
    pay.billhistory = $resource(formatFilter('{0}pay/billhistory/:id/', cfg.api));
    pay.analyse = $resource(formatFilter('{0}pay/analyse/', cfg.api));

    return pay;
});