/**
 * Created by Mai on 2017/4/24.
 */

var billsData = require('../../main/models/bills');

module.exports = {
    copyProjectData: function (srcProjID, newProjID, callback) {
        billsData.getProjectBills(srcProjID).then(function (results) {
            var datas = [];
            results.forEach(function (result) {
                result._doc.projectID = newProjID;
                datas.push(result._doc);
            });
            return billsData.AddBillsFromTemplate(datas, callback);
        }).catch(function (err) {
            callback(err);
        });
    }
};